jQuery:
$(document).on('mouseover', '.image_slider', function() {
setInterval(slider(this), 10000);
});
function slider(that){
console.log(that);
}
Anyone can please tell me Why this function is not working and How can I resolve it?
jQuery:
$(document).on('mouseover', '.image_slider', function() {
setInterval(slider(this), 10000);
});
function slider(that){
console.log(that);
}
Anyone can please tell me Why this function is not working and How can I resolve it?
window.setInterval executes the parameter after the given time. Therefore you should execute it as such:
setInterval ( myFunction, 1000 );
Or
$(document).on('mouseover', '.image_slider', function() {
setInterval(function (e){
slider (this)
}.bind (this), 10000);
});
function slider(that){
console.log(that);
}