Support » Plugin: Easy FancyBox » Adding custom fancy box class trigger not working?

  • Resolved Denis Lam


    I added this to my template’s header. Note that the width and height is different than the default fancybox iframe dimensions specified in the settings.

    <script type="text/javascript">
    $(function() {
    	$('a.CUSTOMTRIGGER').fancybox( $.extend({}, fb_opts, { 'type' : 'iframe', 'width' : 880, 'height' : 600, 'padding' : 0, 'scrolling' : 'auto', 'autoScale' : false, 'titleShow' : false, 'titlePosition' : 'float', 'titleFromAlt' : true }));

    For my HTML,

    <a href="http://TARGETURLFORIFRAME" class="CUSTOMTRIGGER">The Fancybox Link</a>

    Somehow iframe fancybox is not triggered in this setup. Am I doing something wrong?

Viewing 2 replies - 1 through 2 (of 2 total)
  • To change the fancybox dimensions of specific links, I also tried the solution in FAQ such as the examples below but that didn’t work… the container sizes are still the same as all other fancyboxes…

    <a href="#targetd" class="fancybox { width:800, height: 480 }">link</a>

    <a href="" class="fancybox-iframe { width:800, height: 480 }">link</a>


    How do I show content with different sizes?
    FancyBox tries to detect the size of the conten automatically but if it can not find a size, it will default to the settings for that particular content type as set on the Settings > Media page. You can manually override this by defining the width and height wrapped in curly brases in the class attribute of the link itself. For example, a Flash movie with different size

    I finally got it working, the original code was good, I just missed a couple lines of script:

    var fb_timeout = null;
    var fb_opts = { 'overlayShow' : true, 'centerOnScroll' : true, 'showCloseButton' : false, 'showNavArrows' : true, 'onCleanup' : function() { if(fb_timeout) { window.clearTimeout(fb_timeout); fb_timeout = null; } } };

    Thank you for this great plugin!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Adding custom fancy box class trigger not working?’ is closed to new replies.