so ändern, ich habe ein div mit einem Bild, die ich für eine gif ändern möchten, wenn eine bestimmte Schriftrolle aufgetreten ist ...Wie Winkel ng-init attributewith jquery
hier ist die html:
<div class="col-xs-6 mitad" ng-init="varname='images/estandar/impresoraEstandarAnimada.gif'" id="seccion3B">
<img ng-src="{{varname}}" id="gif">
</div>
jetzt, die Idee ist, die uRL in varname zu ändern ... ich habe versucht, dies aber nicht funktioniert hat:
if ($(window).width() > 1700 && vistaEstandar.scrollTop > 1596 && vistaEstandar.scrollTop < 2490)
{
lore: 'url(../images/estandar/monitorVeloz1.gif)';
$("#gif").attr("ng-src", "{{lore}}");
}
eine Ahnung, wie es funktioniert zu machen ?? Ich verstehe Angular nicht sehr gut (neu bei Programmierung) und wenn ich versuche, es ohne Angular zu ändern, indem ich nur das SRC-Attribut vom img-Tag ersetze, lädt das GIF das erste Mal, aber wenn ich es erneut in der if-Bedingung oder wenn I die Website aktualisieren, es lädt als statisches Bild
AKTUALISIERT:
all dieser Code js ist in einem Controller bereits:
app.controller('estandarCtrl', function ($scope, $rootScope, $routeParams, $location, $http, Data)
{
$(document).ready(function(){
// ----Clases para mantener los colores del header
$(".navbar-header").addClass("fondoHeader");
$("#fondoMenu").addClass("fondoHeader");
$("#footer").removeClass("esconder");
$("#social").removeClass("esconder");
$(".navbar-brand").removeClass("esconder");
$("#botonVideo").removeClass("fondoBoton");
$("#vista").removeClass("barraVista");
// ----Propiedades para los scrollbar
var vistaEstandar = document.getElementById('vista');
vistaEstandar.style.overflow= "auto";
vistaEstandar.style.overflowX= "hidden";
vistaEstandar.style.height = 100 + "%";
$("#vista").smoothWheel();
// ---animaciones para diferentes resoluciones
vistaEstandar.onscroll = function() {animacionesEstandarVista()};
function animacionesEstandarVista()
{
if (($(window).width() > 1700 && vistaEstandar.scrollTop > 1596 && vistaEstandar.scrollTop < 2490) || ($(window).width() > 1700 && document.documentElement.scrollTop > 1596 && document.documentElement.scrollTop < 2490)){
}
else if (($(window).width() > 1700 && vistaEstandar.scrollTop > 3888 && vistaEstandar.scrollTop < 4286) || ($(window).width() > 1700 && document.documentElement.scrollTop > 3888 && document.documentElement.scrollTop < 4286)) {
document.getElementById("section6").style.background = "url(images/estandar/monitorEstandarEntrada.gif)";
document.getElementById("section6").style.backgroundSize = "cover";
document.getElementById("section6").style.backgroundPosition = "bottom";
}
else if (($(window).width() > 1700 && vistaEstandar.scrollTop > 4450) || ($(window).width() > 1700 && document.documentElement.scrollTop > 4450)) {
document.getElementById("section6").style.background = "url(images/estandar/monitorEstandarSalida.gif)";
document.getElementById("section6").style.backgroundSize = "cover";
document.getElementById("section6").style.backgroundPosition = "bottom";
}
else
{
}
});
});
so schon ich für die partielle
wo ist das Stück Code geschrieben? – Rachmaninoff
Warum verwenden Sie Angular? Kannst du nicht 'src' Attribut in' img' ändern? –
kann ich aus dem Grund nicht erklären ... wenn es sich ändert ... das gif funktioniert nicht .... es funktioniert nur als gif wenn das erste mal die seite geöffnet wird ... wenn es neu geladen wird wird nicht funktionieren. Nun, das gif ist nur eine einmalige Schleife gif – Caro