(function($) {
jQuery(document).ready(function() {
window.pulse_image = jQuery('.pulse_image');
window.pulse_continue_loop = true;
PulseAnimation();
jQuery('.pulse_image').mouseover(function() {
window.pulse_continue_loop = false;
window.pulse_image.stop();
window.pulse_image.css('opacity',1);
}).mouseout(function() {
// User is hovering over the image.
window.pulse_continue_loop = true;
window.pulse_image = jQuery(this);
PulseAnimation(); // start the loop
});
});
})(jQuery);
// #############################################
function PulseAnimation()
{
var minOpacity = .20;
var fadeOutDuration = 2000;
var fadeInDuration = 2000;
window.pulse_image.animate({
opacity: minOpacity
}, fadeOutDuration, function() {
window.pulse_image.animate({
opacity: 1
}, fadeInDuration, function() {
if(window.pulse_continue_loop) {
setTimeout("PulseAnimation()",8000);
//PulseAnimation();
}
})
});
}