DanC
DanC

Reputation: 1307

jquery functions within Fancybox

I'm using fancybox to load up some inline content on a web page.

Fancybox loads up fine as do the images, the only problem is that I would like certain jquery functions to work within the modal window which will not load up.

The jquery functions work fine when I load them outside of fancybox so was wondering if anyone knows how to call these functions when the window is open?

EDIT

so i have tried the callbackonshow but cannot get it to work, what am i doing wrong here?

    <script type="text/javascript">
    jQuery(document).ready(function($) {

    function hover() {
    $("#container ul#thumbnails li a").hover(
        function(){

      var largePath = $(this).attr("name");

      $("#container #main_image img#largeId").attr({ src: largePath }); return false);
    }

    $("a.group").fancybox({
              'frameWidth': 966,
              'frameHeight': 547,
              'hideOnContentClick': false,
              'callbackOnShow': hover
              });

   });
   </script>

Upvotes: 1

Views: 2687

Answers (1)

Brandon Joyce
Brandon Joyce

Reputation: 3110

You probably just need to use the callbackOnShow option to pass in a function.

It's outlined here: Fancy Box

Brandon Joyce

Upvotes: 1

Related Questions