Support » Plugin: jQuery Colorbox » [Plugin: jQuery Colorbox] Colorbox for links not working on dynamically created links

  • Resolved alexleonard

    (@alexleonard)


    Hey there,

    First let me say that Colorbox is totally awesome. Hands down best lightbox plugin I’ve used for WordPress 🙂

    I’ve been working on a site where I use the colorbox for links functionality a fair bit, and it’s been working great so far.

    However I’ve run into one small issue where it’s not working in one place where the link is dynamically placed as a result of a jQuery AJAX call.

    The HTML returned from the AJAX query includes an anchor with a class of ‘colorbox-link’. This is working without issue on the rest of the ‘static’ html links with this class.

    I think it’s probably due to use of .bind instead of .on, I think. Certainly I noticed this issue before where I was trying to adjust a dynamically created select option. It only worked when I switched to .on(‘change’, etc {

    Is this something that I could manually over-ride without adjusting the plugin-code, or do I need to hope that a plugin update might fix it?

    Thanks!
    Alex

    http://wordpress.org/extend/plugins/jquery-colorbox/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor techotronic

    (@techotronic)

    the Colorbox effect is applied to images and links by the JavaScript in the file jquery-colorbox-wrapper.js.
    The main method for you to look at would be colorboxSelector().
    You’ll have to call that every time links or images are added to the page with AJAX.

    Cheers,
    Arne

    Hi Arne,

    Thanks for the reply and damn I’m ashamed I didn’t respond quicker..

    In the end the client dropped the requirement I needed, but I think I could have handled it by just adding a new colorbox function call in my header.

    I actually did this to give me control over another element which needed to be colorboxed with a different iframe size

    jQuery(document).ready(function($){
        $("#colourbox_newsletter_signup").colorbox({iframe:true, width:"532px", height:"400px"});
    });

    Cheers!
    Alex

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Plugin: jQuery Colorbox] Colorbox for links not working on dynamically created links’ is closed to new replies.