Wordpress thickbox Add "view artwork" effect Code _javascript Tips

Source: Internet
Author: User
In Wp-includes/js/thickbox/thickbox.js about 39 lines of function Tb_show (caption, URL, imagegroup), add the following line (bold red word means the newly added code)
Copy Code code as follows:

function Tb_show (caption, URL, imagegroup) {//function Called when the user clicks on a thickbox link

try {
Code omitted ...
tb_nexthtml = "";
Tb_imagecount = "";
Tb_foundurl = false;
Open a new window to display the original artwork
tb_opennewhtml = "";

if (ImageGroup) {
Code omitted ...
if (Tb_foundurl) {
Tb_nextcaption = Tb_temparray[tb_counter].title;
Tb_nexturl = Tb_temparray[tb_counter].href;
tb_nexthtml = "<span id= ' Tb_next ' > <a href= ' # ' >" +thickboxl10n.next+ "</a></span>";
} else {
Tb_prevcaption = Tb_temparray[tb_counter].title;
Tb_prevurl = Tb_temparray[tb_counter].href;
tb_prevhtml = "<span id= ' Tb_prev ' > <a href= ' # ' >" +thickboxl10n.prev+ "</a></span>";
}
Open a new window to display the original artwork
tb_opennewhtml = "<span style= ' font-size:11pt ' > <a href= '" +url+ "' target= ' _blank ' style= '" color:red ' > View original image & Lt;/a></span> ";

} else {
Tb_foundurl = true;
Tb_imagecount = thickboxl10n.image + ' + (Tb_counter + 1) + ' + thickboxl10n.of + ' + (tb_temparray.length);
Open a new window to display the original artwork
tb_opennewhtml = "<span style= ' font-size:11pt ' > <a href= '" +url+ "' target= ' _blank ' style= '" color:red ' > View original image & Lt;/a></span> ";
}
}
}
}

Code omitted ...

Resizing large images-orginal by Christian Montoya by me.

Code omitted ...
End resizing

Tb_width = ImageWidth + 30;
Tb_height = ImageHeight + 60;
JQuery ("#TB_window"). Append ("<a href=" id= ' Tb_imageoff ' title= ' "+thickboxl10n.close+" ' ></a> ' "+" <div id= ' Tb_caption ' > ' +caption+ ' <div id= ' tb_secondline ' > ' + tb_imagecount + tb_prevhtml + tb_nexthtml + ' </div>& Lt;/div><div id= ' Tb_closewindow ' ><a href= ' id= ' Tb_closewindowbutton ' title= ' +thickboxL10n.close+ ' ></a></div> ");
Show next picture + new Window view artwork (add tb_opennewhtml)
JQuery ("#TB_window"). Append ("<a href=" id= ' tb_nextimage ' title= ' "+thickboxl10n.next+" ' ></a> ' "+" <div id= ' Tb_caption ' > ' +caption+ ' <div id= ' tb_secondline ' > ' + tb_imagecount + tb_prevhtml + tb_nexthtml + TB_OpenNewHTML + "</div></div><div id= ' Tb_closewindow ' ><a href= ' # ' id= ' Tb_closewindowbutton ' title= '" "+ Thickboxl10n.close+ "' ></a></div>");


JQuery ("#TB_closeWindowButton"). Click (Tb_remove);

if (!) ( tb_prevhtml = = "")) {
Code omitted ...

Effect:

After clicking "View Original Image", the original image will be displayed in the new browser window (TAB).
Author: elf Sundae (small confused)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.