How To Add The Img-responsive Class In Javascript
I am trying to make a responsive slider for mobile version. Site was developed using angular JS. When I am trying to integrate the JQuery sliders, total site was distubing because
Solution 1:
Previous answers are correct but you have to use $ for jQuery:
$(slideimages[0]).addClass("img-responsive");
WIthout jQuery:
slideimages[0].className += "img-responsive";
Solution 2:
To add a class, just use addClass:
slideimages[0].addClass("img-responsive");
Are you just trying to add a class? I don't quite understand your question.
Solution 3:
EDITED you simply need to do this:
functionslideit(){
//if browser does not support the image object, exit.if (!document.images)
returndocument.getElementById('slide').src = slideimages[step].srcdocument.getElementById('slide').className = "img-responsive";
whichimage = step
if (step<2)
step++
else
step=0//call function "slideit()" every 2.5 secondssetTimeout("slideit()",2500)
}
Post a Comment for "How To Add The Img-responsive Class In Javascript"