
zShowBox.js
/*
* zShowBox (图片放大展示)
*/
function zShowBox(domChunk) {
//为每张图片链接加上 class=”zshowbox”
var zcounter = 0;
$(domChunk + ‘ a’).each(function () {
var a_href = $(this)[0].href.toLowerCase();
var file_type = a_href.substring(a_href.lastIndexOf(‘.’));
if (file_type == ‘.jpeg’ || file_type == ‘.jpg’ || file_type == ‘.png’ || file_type == ‘.gif’ || file_type == ‘.bmp’) { $(this).addClass(‘zshowbox’).attr(‘id’, ‘zsb-‘ + zcounter); zcounter++; };
});
$(domChunk + ‘ a.zshowbox’).click(function () {
var current = $(this).attr(‘id’).split(‘zsb-‘)[1],
pagesize = zsb_getPageSize(),
zsb_img_url = $(this).attr(‘href’),
css_zsb_bg = ‘z-index:9999;overflow:hidden;position:fixed;left:0;top:0;width:100%;height:100%;background:#000 url(‘ + loadingimg + ‘) no-repeat center center;’,
css_zsb = ‘z-index:99999;position:fixed;left:50%;top:50%;’,
css_zsb_img = ‘display:none;border:5px solid #777;border-radius:6px;-moz-border-radius:6px;-webkit-border-radius:6px;box-shadow:1px 1px 5px #333,-1px -1px 5px #333;-moz-box-shadow:1px 1px 5px #333,-1px -1px 5px #333;-webkit-box-shadow:1px 1px 5px #333,-1px -1px 5px #333;’,
css_zsb_p_n = ‘display:none;cursor:pointer;position:absolute;top:50%;line-height:80px;margin:-40px 0 0 0;color:#eee;text-shadow:1px 3px 5px #000;font-size:40px;font-family:Arial,Tahoma;’;
if (typeof document.body.style.maxHeight === “undefined”) { //if IE 6
alert(IE6!太落后了……’);
return false;
} else {
$(‘body’).append(‘<div id=”zsb_bg” style=”‘ + css_zsb_bg + ‘”></div><div id=”zsb” style=”‘ + css_zsb + ‘”><img id=”zsb_img” style=”‘ + css_zsb_img + ‘” /><p id=”zsb_prev” style=”left:-30px;’ + css_zsb_p_n + ‘”>«</p><p id=”zsb_next” style=”right:-30px;’ + css_zsb_p_n + ‘”>»</p></div>’);
$(‘#zsb_bg’).fadeTo(600, 0.7);
zsh_img(‘#zsb_img’, zsb_img_url, pagesize, current, zcounter);
$(‘#zsb_prev,#zsb_next’).click(function () {
if ($(this).attr(‘id’) == ‘zsb_prev’) current–; else current++;
$(this).parent().prev().css(“background-image”, ‘url(‘ + loadingimg + ‘)’);
$(‘#zsb’).find(‘img’).remove().end().append(‘<img id=”zsb_img” style=”‘ + css_zsb_img + ‘” />’);










