Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Colorbox doesn't work after update from v1.3.19 to v1.4.6

I updated Colorbox.min.js file from v1.3.19 to v1.4.6 and some of my colorboxes doesn't work. I don't get any error on page and Chrome's console.

I checked for changelog but I didn't find the anser. Can you help please?

(I use jQuery 1.7.2)

  • This doesn't work:
<a href="#" onclick="emailDialog()">e-mail</a>
function emailDialog(){  
    $.fn.colorbox({  
        width:"700px", height:"550px",  
        iframe:true, href:"/contact",  
        opacity:0.6  
    });  
}
  • This works well:
<a href="http://example.com/1.jpeg" class="colorbox-avatar" title="some title" rel="nofollow" >photo</a>
$(document).ready(function() {  
    $(".colorbox-avatar").colorbox({  
        rel:'colorbox-avatar',  
        scrolling: false,  
        current: "",  
        slideshow:true, slideshowAuto:false,  
        opacity:0.6,  
        width:"60%" , height:"60%"  
    });  
}  
like image 360
trante Avatar asked Nov 12 '22 08:11

trante


1 Answers

call it without the .fn ... so $.colorbox({...})

($.fn is used for developing jQuery plugins and is really just shorthand for $.prototype).

function emailDialog(){
    $.colorbox({
        width:"700px", height:"550px",
        iframe:true, href:"/contact",
        opacity:0.6
    });   
}

jsfiddle demo

like image 139
MikeM Avatar answered Nov 15 '22 05:11

MikeM