Hello, I would package your code differently, something like (this is an example):
Code:
(function($) {
$.fn.animate = function(options) {
var defaults = {
speed: 1000,
pause: 3000
};
var options = $.extend(defaults, options);
this.each(function() {
var obj = $(this);
// possible code here on obj
var timer = setInterval(function() {
animateopener();
}, options.pause);
// Pause the animation on mouse over
obj.hover(
function () {
clearInterval(timer);
},
function () {
timer = setInterval(function(){
animateopener();
}, options.pause);
}
);
function animateopener() {
// your code here
};
});
};
})(jQuery);
jQuery(document).ready(function($) {
$("some html element here").animate({
speed: 1000,
pause: 3000
});
});