Hi I need to do bellow jquery function without click next button. I tried so many was but those are not working can any one give me a proper way to do this please
var clickNext = $(".next_button").click(function() {
var imgWidth = $("#slider_box_01").width();
var numImgs = 16;
var count = 0;
slideId++;
if (slideId == 3) {
slideId = 0;
}
imageSlider(imgWidth, numImgs, count, slides, slideId);
});
function imageSlider(imgWidth, numImgs, count, slides, slideId) {
var animation = setInterval(function() {
var position = -1 * (count * imgWidth);
$('#slider_box_01').find('.slider_image').css('margin-left', position);
count++;
if (count == numImgs) {
count = 0;
$('#slider_box_01').find('.slider_image').css('margin-left', 0 );
$(".slider_image").attr("src", slides[slideId]);
clearInterval(animation);
}
}, 80);
this function works well if I click the .next_button but I need to do that without click any button after load my web page every 2 second.