jQuery init function not working -


jquery code:

$(window).load(function(){     $("#slider").flexslider({         animation: "slide",         controlnav: false,         directionnav: false,         init: function (slider) {             // lazy load             $("img.lazy").slice(0,1).each(function () {                 alert('init running');                 var src = $(this).attr("data-src");                 $(this).attr("src", src).removeattr("data-src").removeclass("lazy");             });         },         before: function (slider) {             // lazy load             $("img.lazy").slice(0,2).each(function () {                 alert('before running');                 var src = $(this).attr("data-src");                 $(this).attr("src", src).removeattr("data-src").removeclass("lazy");             });         },         animationloop: false,         slideshow: false,         sync: "#carousel",     }) }) 

jsfiddle url:

https://jsfiddle.net/6z5l31tg/ 

init function not working. not alerting me. can please explain me why not working? , how can resolve issue? weak in english. please apologize me if made grammatical or spelling mistakes.

you using .load() event, replaced same named ajax method in jquery 3.0.

from upgrade guide:

the event .load() method conflicted ajax .load() method. .error() method not used window.onerror because of way dom method defined. if need attach events these names, use .on() method, e.g. change $("img").load(fn) $(img).on("load", fn).

i advise load slider when dom ready. updated fiddle: https://jsfiddle.net/6z5l31tg/2/


Comments

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -