javascript - Indicator for a 360 image rotation -
i have simple 360 image rotator cycles through series of images create effect of rotating object. want add indicator shows users can rotate object fades out after fist image has been past. added function end of 360.js
(function(){ if( $('#first').css('visibility','hidden')) { $('#rotate').fadeout(); } else { $('#rotate').fadein(); } }); theres no error in script, it's not checking see if image visible or not. tried binding mousedown , mousemove events called in 360.js no luck. 1 have ideas on how resolve this?
heres fiddle
there 1 major problem beside listed on comments.
you're setting currentimage 1, instead of 0, , indexing 0 based. image want never again visible, fading in never happens.
i check whether has class 'notseen', though checking hidden should have been good.
here's latest fix, , should see works: http://jsfiddle.net/y7wma/6/
and here significant snippets:
.bind('mousemove touchmove', function (e) { fadeinout(); // ... if (math.abs(currpos - pagex) >= widthstep) { if (currpos - pagex >= widthstep) { currimg++; if (currimg > imagetotal) { currimg = 0; } } else { currimg--; if (currimg < 0) { currimg = imagetotal; } } // ... function fadeinout() { if ($('#first').hasclass('notseen')) { console.log("hidden"); $('#rotate').fadeout(); } else { console.log("visible"); $('#rotate').fadein(); } };
Comments
Post a Comment