Error jQuery(domChunk).live is not a function
Error: jQuery(domChunk).live is not a function Source File: http:///wp-includes/js/thickbox/thickbox.js?ver=3.1-20110528 Line: 26
This is the function:
//add thickbox to href &a开发者_如何学运维mp; area elements that have a class of .thickbox
function tb_init(domChunk){
jQuery(domChunk).live('click', tb_click);
}
Using jQuery version 1.6.1. Is there any way around this error?
I used jQuery(domChunk).bind instead
To fix thickbox.js replace the tb_init() function with the one below - this will support all versions of jquery! It checks whether on() function exists, if not it will fallback to live().
function tb_init(domChunk){
if($.isFunction($domChunk).on))
{
$(domChunk).on('click', domChunk, function(){
var t = this.title || this.name || null;
var a = this.href || this.alt;
var g = this.rel || false;
tb_show(t,a,g);
this.blur();
return false;
});
}
else
{
$(domChunk).live('click', function(){
var t = this.title || this.name || null;
var a = this.href || this.alt;
var g = this.rel || false;
tb_show(t,a,g);
this.blur();
return false;
});
}
}
精彩评论