Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Dan Zappone

    (@dzappone)

    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();
        });
    });
    Thread Starter Rizki Andrianto

    (@rizkiandrianto)

    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 ! ??

    You probably want to use .on not .live https://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 https://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.

    Plugin Author Dan Zappone

    (@dzappone)

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

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Click Image To Close’ is closed to new replies.