How do i fire a click continuously while something is hovered?

后端 未结 4 716
长发绾君心
长发绾君心 2021-01-07 10:01

Im pretty sure this has a simple solution. I am using jCarousellite, and i want to change the behaviour of built in nav buttons to fire on hover over.

$(\"#         


        
4条回答
  •  Happy的楠姐
    2021-01-07 10:36

    You can set an interval for clicking like this, just do the same for the opposite button:

    $("#carousel .btn-down").hover(function() {
      $(this).data("to", setInterval(function() { $("#carousel .btn-down").click(); }, 200));
    }, function() {
      clearInterval($(this).data("to"));
    });
    

提交回复
热议问题