Trigger fancybox with hover instead of click?

kylex picture kylex · Nov 12, 2009 · Viewed 14.1k times · Source

I'm trying to get fancybox to trigger when the mouse is hovered over a link.

Have had no luck though... any suggestions?

$(document).ready(function() { 
/* This is basic - uses default settings */     
    $("a.inline").fancybox({ 'hideOnContentClick': false });    
});

Answer

BStruthers picture BStruthers · Nov 12, 2009

One way would be to fire the click when the hover event is triggered.

$("a.inline").fancybox().hover(function() {
    $(this).click();
});