here the jsfiddle link to my problem http://jsfiddle.net/XnnvD/35/ (not quite working)
I'll try explaining what the problem is, I have 3 sets of animation in jQuery
1- Image bounces and fades away after some TimePeriod as below:
$('#homePageImage').animate(
{ top: '50px' },
{ queue: false, duration: 1000, easing: 'easeOutBounce' });
$('#homePageImage').delay(3000).effect('drop', { direction: "right" });
2- Set of images .fadeIn()
randomly as below:
randNumArray = shuffle(randNumArray);
for (var i = 0; i < 9; i++)
{ $('#fs' + randNumArray[i]).delay(j += 200).fadeIn(j); }
3- Hovering over these images, will enlarge them as below:
$(function () {
$("ul.thumb li").hover(function () {
$(this).css({ 'z-index': '10' });
$(this).find('img').addClass("hover").stop().animate({
marginTop: '-110px',
marginLeft: '-110px',
top: '50%',
left: '50%',
width: '174px',
height: '174px',
padding: '20px'
}, 500);
}, function () {
$(this).css({ 'z-index': '0' });
$(this).find('img').removeClass("hover").stop().animate({
marginTop: '0',
marginLeft: '0',
top: '0',
left: '0',
width: '100px',
height: '100px',
padding: '5px'
}, 500);
});
});
The Problem:
If the user hovers before the 1st set of animation is complete, the images don't .fadeIn()
completely, and hence are partially/not visible
What I want: I want the 3rd set (hovering to enlarge) to remain inactive till my 1st and 2nd set of animations are complete, how can I do this?
Thanks
Put your Hover function in a SetTimeOut function like this
setTimeout((function () {
$("ul.thumb li").hover(function () {
$(this).css({ 'z-index': '10' });
$(this).find('img').addClass("hover").stop().animate({
marginTop: '-110px',
marginLeft: '-110px',
top: '50%',
left: '50%',
width: '174px',
height: '174px',
padding: '20px'
}, 500);
}, function () {
$(this).css({ 'z-index': '0' });
$(this).find('img').removeClass("hover").stop().animate({
marginTop: '0',
marginLeft: '0',
top: '0',
left: '0',
width: '100px',
height: '100px',
padding: '5px'
}, 500);
});
}), *Put time in miliseconds*);
So this will ensure that the hover doesn't happen till the specified time period!