WordPress.org

Ready to get started?Download WordPress

Forums

Lightbox Plus Colorbox
[resolved] Click Image To Close (5 posts)

  1. Rizki Andrianto
    Member
    Posted 1 year ago #

    umm.. Would you think it would be nice if we have "Click image to close" fiture?
    Of course with overlay text "Click image to close" in the middle of picture ;)

    Or maybe you want to give me a lesson to add it manually? :p ;)

    http://wordpress.org/extend/plugins/lightbox-plus/

  2. Dan Zappone
    Member
    Plugin Author

    Posted 1 year ago #

    You can probably do something like this:

    Add a file called helper.js to the css directory of the style you are using and add the following code:

    $(document).ready(function(){
        $('#colorbox').live('click', function(){
            $.fn.colorbox.close();
        });
    });
  3. Rizki Andrianto
    Member
    Posted 1 year ago #

    Whoa... That works ! :)
    Btw, I add those code like this

    jQuery(document).ready(function($){
        $(document).bind('cbox_open', function () {
            // Hide close button initially.
            $('#cboxClose').css('opacity', 0);
        });
        $(document).bind('cbox_complete', function () {
            // Show close button with a delay.
            $('#cboxClose').show('fast', 0, function () {$(this).css('opacity', 1)});
        });
    	$(document).ready(function(){
        $('#colorbox').live('click', function(){
            $.fn.colorbox.close();
        });
    });
    });

    Not like this

    jQuery(document).ready(function($){
        $(document).bind('cbox_open', function () {
            // Hide close button initially.
            $('#cboxClose').css('opacity', 0);
        });
        $(document).bind('cbox_complete', function () {
            // Show close button with a delay.
            $('#cboxClose').show('fast', 0, function () {$(this).css('opacity', 1)});
        });
    });
    
    $(document).ready(function(){
        $('#colorbox').live('click', function(){
            $.fn.colorbox.close();
        });
    });

    Thank you very much ! :)

  4. tzdk
    Member
    Posted 1 year ago #

    You probably want to use .on not .live http://api.jquery.com/live/ Is removed in version jQuery 1.9.

    1.9 comes with a migrate.js file to make sure old code work, and WordPress will hopefully include that in 3.6 or support forums will blow up, but still.

    Why forums will blow up can be seen in their post for an update to migrate http://blog.jquery.com/2013/01/31/jquery-migrate-1-1-0-released/

    Judging by many of the questions and bug reports we’ve gotten, far too many of you are trying to do an upgrade to jQuery 1.9 without also using jQuery Migrate. Stop hitting yourself! We created this plugin to make things easy on you.

    Probably best to make migrate.js do as little as possible but it will make .live work.

  5. Dan Zappone
    Member
    Plugin Author

    Posted 1 year ago #

    @tzdk Right on. Was digging through some old code and found that example.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags