Home  >  Article  >  Web Front-end  >  Wordpress ThickBox adds "View original image" effect code_javascript skills

Wordpress ThickBox adds "View original image" effect code_javascript skills

WBOY
WBOYOriginal
2016-05-16 18:14:051875browse

In function tb_show(caption, url, imageGroup) on line 39 of wp-includes/js/thickbox/thickbox.js, add the following line (bold red text represents the newly added code)

Copy code The code is 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 image
TB_OpenNewHTML = "";

if(imageGroup){
/// Code omitted. . . < a href='#'>" thickboxL10n.next "";
} else {
TB_PrevCaption = TB_TempArray[TB_Counter].title;
TB_PrevURL = TB_TempArray[ TB_Counter].href;
TB_PrevHTML = " " thickboxL10n.prev "";
}
////// Open a new window to display the original image
TB_OpenNewHTML = " View original image";

} else {
           TB_FoundURL = true;
 TB_imageCount = thickboxL10n.image ' ' (TB_Counter 1) ' ' thickboxL10n.of ' ' (TB_TempArray.length);
////// Open a new window to display the original image
TB_OpenNewHTML = " View original image";
}
}
}
}

/// Code omitted. . .

// Resizing large images - orginal by Christian Montoya edited by me.

/// Code omitted. . .
// End Resizing

TB_WIDTH = imageWidth 30;
TB_HEIGHT = imageHeight 60;
//jQuery("#TB_window").append("" caption " " "
" caption "
" TB_imageCount TB_PrevHTML TB_NextHTML "
< ;div id='TB_closeWindow'>");
/////// Show the next picture in a new window to view the original picture (add TB_OpenNewHTML)
jQuery("#TB_window").append("
" caption "" "
" caption "
" TB_imageCount TB_PrevHTML TB_NextHTML TB_OpenNewHTML "
");


jQuery("#TB_closeWindowButton").click(tb_remove);

if (!(TB_PrevHTML == = "")) {
/// Code omitted. . .


Effect:


After clicking "View Original Image", the original image will be displayed in a new browser window (Tab).

Author: Elf Sundae (Little Confused)


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn