I'm using this blink function
(function($)
{
$.fn.blink = function(options)
{
var defaults = { delay:500 };
var options = $.extend(defaults, options);
return this.each(function()
{
var obj = $(this);
setInterval(
function(){
if($(obj).css("visibility") == "visible") {
$(obj).css('visibility','hidden');
}
else{
$(obj).css('visibility','visible');
}
},
options.delay);
});
}
}(jQuery))
$("#bootUp p").blink({delay:300});
I'd like for it to stop on window.load
I'm not sure how to do it, exactly? Any help would be much appreciated. Thanks!
Live Demo
You need to track the ints returned from setInterval and then clearInterval for each of them.
var intervals = new Array();
(function($)
{
$.fn.blink = function(options)
{
var defaults = { delay:500 };
var options = $.extend(defaults, options);
return this.each(function()
{
var obj = $(this);
intervals[intervals.length] = setInterval(
function(){
if($(obj).css("visibility") == "visible") {
$(obj).css('visibility','hidden');
}
else{
$(obj).css('visibility','visible');
}
},
options.delay);
});
}
}(jQuery))
$("#bootUp p").blink({delay:300});
$("#bootUp2 p").blink({delay:300});
$(document).ready(function(){
for(var i=0;i<intervals.length;i++){
clearInterval(intervals[i]);
}
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With