WordPress.org

Ready to get started?Download WordPress

Forums

Easy FancyBox
[resolved] Adding custom fancy box class trigger not working? (3 posts)

  1. Denis Lam
    Member
    Posted 1 year ago #

    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 }));
    });
    </script>

    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?

    http://wordpress.org/extend/plugins/easy-fancybox/

  2. Denis Lam
    Member
    Posted 1 year ago #

    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="http://xyz.com" 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

  3. Denis Lam
    Member
    Posted 1 year ago #

    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!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.