您好,欢迎访问一九零五行业门户网

Wordpress ThickBox 添加“查看原图”效果代码_javascript技巧

在 wp-includes/js/thickbox/thickbox.js 大概39行的function tb_show(caption, url, imagegroup)中,添加如下行(粗体红色字代表新添加的代码)
复制代码 代码如下:
function tb_show(caption, url, imagegroup) {//function called when the user clicks on a thickbox link
try {
/// 代码省略。。。
tb_nexthtml = ;
tb_imagecount = ;
tb_foundurl = false;
////// 打开新窗口显示原图
tb_opennewhtml = ;
if(imagegroup){
/// 代码省略。。。
if (tb_foundurl) {
tb_nextcaption = tb_temparray[tb_counter].title;
tb_nexturl = tb_temparray[tb_counter].href;
tb_nexthtml =   +thickboxl10n.next+;
} else {
tb_prevcaption = tb_temparray[tb_counter].title;
tb_prevurl = tb_temparray[tb_counter].href;
tb_prevhtml =   +thickboxl10n.prev+;
}
////// 打开新窗口显示原图
tb_opennewhtml =   查看原图;
} else {
 tb_foundurl = true;
tb_imagecount = thickboxl10n.image + ' ' + (tb_counter + 1) + ' ' + thickboxl10n.of + ' ' + (tb_temparray.length);
////// 打开新窗口显示原图
tb_opennewhtml =   查看原图;
}
}
}
}
/// 代码省略。。。
// resizing large images - orginal by christian montoya edited by me.
/// 代码省略。。。
// end resizing
tb_width = imagewidth + 30;
tb_height = imageheight + 60;
//jquery(#tb_window).append( + +caption+ + tb_imagecount + tb_prevhtml + tb_nexthtml +
);
/////// 显示下一张图 + 新窗口查看原图(添加tb_opennewhtml)
jquery(#tb_window).append( + +caption+ + tb_imagecount + tb_prevhtml + tb_nexthtml + tb_opennewhtml +
);
jquery(#tb_closewindowbutton).click(tb_remove);
if (!(tb_prevhtml === )) {
/// 代码省略。。。
效果:
点击“查看原图”后,将在浏览器新窗口(tab)显示原图。
作者:elf sundae (小糊涂)
其它类似信息

推荐信息