lundi 25 juillet 2016

How to change angular ng-init attributewith jquery

so, I have a div with an image which I want to change for a gif when a specific scroll has occurred...

here is the html:

    <div class="col-xs-6 mitad" ng-init="varname='images/estandar/impresoraEstandarAnimada.gif'" id="seccion3B">
        <img ng-src="" id="gif">
    </div>

now, The idea is, to change the url in varname... I tried this but didn't work:

if ($(window).width() > 1700 && vistaEstandar.scrollTop > 1596 && vistaEstandar.scrollTop < 2490)
       {
            lore: 'url(../images/estandar/monitorVeloz1.gif)';
            $("#gif").attr("ng-src", "");
        }

any idea how to make it work?? I don't understand Angular very well (new at programming) and if I try to change it without Angular by just replacing the SRC attribute from the img tag, the gif loads the first time but if enter again in the if condition or if I refresh the website, it loads as static image

Aucun commentaire:

Enregistrer un commentaire