Alexander Hein Alexander Hein - 1 year ago 100
jQuery Question

How can I run this function on hover?

How can I run this function on hover?

$cellButtonGroup.on( 'click', '.button', function() {
var index = $(this).index();
$carousel.flickity( 'select', index );

This did not work:

$cellButtonGroup.on( 'hover',

Answer Source

try this

$cellButtonGroup.hover(function() {
  //your code here

or else you can use mouseenter and mouseleave insted of above with following ways.

1st way

$cellButtonGroup.mouseenter(function() {
      //your code here

$cellButtonGroup.mouseleve(function() {
      //revise your code here [ex: if your add some class in mouseenter, remove that in here]

2nd way

      $("your selector").addClass("thisIsanExample", function(){
      $("you selector").removeClass("thisIsanExample");

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download