javascript - What does function(i) mean in this jQuery code? -
This is a sample code from a jQuery book that rotates through images, I understand the majority of it except the part The function is called (i). Is the value (i) being passed as an argument and when (i) numberoffofoto is being reduced, then the same value is being reduced?
$ (document) .ready (function () {RotatePics (1);}); Function Rotate Pics (current photo) {var numberOfPhotos = $ ('# photos img'). Length; CurrentPhoto = Current photo% numberofFoto; $ ('# Photos img'). Eq (current photo). Fade (function () {$ ('# photos img'). (Function (i) {$ (this) .Css ('zIndex', ((numberOf photo - i) + current photo)% numberOfPhotos;}; $ (This). Show Timeout (function () {rotatePics (++ current photo);}, 4000);})}} "post-text" itemprop = "text"> The function that passes the function ( function (i) {} {/ code> ... here) and instead of the two variables
The second value is Then, i here index Is because this is the first argument As a result, images will be displayed for the first time on the back of the previous background, because a high i , the lower zIndex < / Code> means that the element will appear in front of an element with a low ZIndex . then, high i , less ZIndex , and it will be pushed in the background.
Comments
Post a Comment