aika Posted November 13, 2011 Report Share Posted November 13, 2011 (edited) FadeIn problēma atraisinājās, parādījās nākamā.. $(function(){ $('.outerContainer').hover( function(){ $('.outerContainer .image').show().animate({opacity:1}, 500); }, function(){ $('.outerContainer .image').stop().animate({opacity:0}, 500); } ); }); Pastāv iespēja šādu kodu optimizēt, lai pie vairākiem hover notikumiem, nenotiktu cikliska funkcijas izpildīšanās? Edited November 13, 2011 by aika Quote Link to comment Share on other sites More sharing options...
Kavacky Posted November 14, 2011 Report Share Posted November 14, 2011 Jā, piemēram, papildu mainīgais, ko pārbauda pirms fadeIn, vai tas satur atļautu vērtību, lai feidotu, tad uzstāda neatļautu, bet fadeOut beigās uzstāda atkal atļautu. Vai pie fadeIn noņem eventa handleri no elementa, bet pēc fadeOut uzstāda atpakaļ. Quote Link to comment Share on other sites More sharing options...
indoom Posted November 14, 2011 Report Share Posted November 14, 2011 vai pareizāk, izmantojot .stop() abās vietās Quote Link to comment Share on other sites More sharing options...
Kavacky Posted November 14, 2011 Report Share Posted November 14, 2011 Slikts variants no interfeisa viedokļa, manuprāt, jo izskatīsies saraustīti. Quote Link to comment Share on other sites More sharing options...
codez Posted November 14, 2011 Report Share Posted November 14, 2011 ja lieto .stop() bez parametriem, tad nav saraustīts, ja lieto .stop(true,true), tad ir. Quote Link to comment Share on other sites More sharing options...
aika Posted November 14, 2011 Author Report Share Posted November 14, 2011 jap! Stops palīdzēja! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.