html
<div class ="anim" id ="anim1">
</div> <!--closes anim1-->
<div class ="anim" id ="anim2">
</div> <!--closes anim2-->
<div class ="anim" id ="anim3">
</div> <!--closes anim3-->
<div class ="anim" id ="anim4">
</div> <!--closes anim4-->
css
.anim{width:400px;height:240px;display:none;position:relative;top:40px;left:20px}
#anim1{background:red}
#anim2{background:green}
#anim3{background:blue}
#anim4{background:yellow}
jQ
$(document).ready(function() {
(function($) {
$.fn.slido = function() {
var elements = this;
l = elements.length;
i = 0;
function execute() {
var current = $(elements[i]);
i = (i + 1) % l;
current
.animate({width:"toggle"},1000)
.delay(6000)
.animate({width:"toggle"},1000,execute);
}
execute();
return this;
};
})(jQuery);
$(".anim").slido();
});
A demostration for what I've done so far can be found here www.mygeneric.info/designwizz/index.php
Well now for the pause and resume part, I want to interrupt the animation every time the user hovers over any of the divs, and resume the animation when the mouse is removed. I hope to accomplish this (not sure if this would work) by modifying the execute function above, by inserting a callback pause function which would be executed if the hover event takes place as follows.
current.animate({width:"toggle"},1000,pause);
function pause(){ if (hover event takes place on this) {//show this} else {//Continue the animation
delay(6000) current.animate({width:"toggle"},1000,execute);}
}
Now if at all that makes any sense, I need to know how I would phrase the (hover event takes place on this) portion in jQ if such a thing is possible. Thanks in advance.

New Topic/Question
Reply


MultiQuote



|