jquery ajax load() content in lightbox

I’m in a wordpress portfolio theme development and having some problem with a feature I want to apply to the theme.
the feature is “quick view” on homepage. basicly the idea is to load a gallery and content from thw wordpress post and show it in a lightbox after a user click on an image.

I have a working code that loads the right content and shows it in a lightbox (colorbox). this content contain a gallery based on jquery and the problem is that the lightbox just doest “activate” the gallery with the jquery code..

Read More
    $(".quick-look-btn").click(function () {
        $(".quick-view").load($(this).attr("href") + " .portfolio-main");
    });

    var $form = $(".quick-view").first();
    $(".quick-look-btn").colorbox({
        inline:true, 
        href:$form, 
        width:"750", 
        height:"367"
    });

thanks!

Related posts

Leave a Reply

1 comment

  1. Assuming your jquery for the gallery is something like this…

    $('leftbutton').on('click', function(){
              // Slide images left...blah blah
    });
    

    This will only affect elements already on the page…
    To attach functions to elements dynamically added to the page, you need to do it like this

    $('body').on('click', 'leftbutton', function(){
              // Slide images left...blah blah
    });
    

    This will ensure that all elements such as ‘.leftbutton’ that exist in the ‘body’ will be attached, even if the elements are added later on.

    Check this out to learn more if you’d like! http://api.jquery.com/on/