|
|
|
|
/*
|
|
|
|
|
* sGallery 1.0 - simple gallery with jQuery
|
|
|
|
|
* made by bujichong 2009-11-25
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD>ߣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> 2009-11-25
|
|
|
|
|
* http://hi.baidu.com/bujichong/
|
|
|
|
|
* <EFBFBD><EFBFBD>ӭ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ת<EFBFBD>أ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ͷ<EFBFBD><EFBFBD>ɹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Դ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
(function ($) {
|
|
|
|
|
$.fn.sGallery = function (o) {
|
|
|
|
|
return new $sG(this, o);
|
|
|
|
|
//alert('do');
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var settings = {
|
|
|
|
|
thumbObj:null,//Ԥ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
titleObj:null,//<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
botLast:null,//<EFBFBD><EFBFBD>ť<EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD>
|
|
|
|
|
botNext:null,//<EFBFBD><EFBFBD>ť<EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD>
|
|
|
|
|
thumbNowClass:'now',//Ԥ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǰ<EFBFBD><EFBFBD>class,Ĭ<EFBFBD><EFBFBD>Ϊnow
|
|
|
|
|
slideTime:800,//ƽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>
|
|
|
|
|
autoChange:true,//<EFBFBD>Ƿ<EFBFBD><EFBFBD>Զ<EFBFBD><EFBFBD>л<EFBFBD>
|
|
|
|
|
changeTime:5000,//<EFBFBD>Զ<EFBFBD><EFBFBD>л<EFBFBD>ʱ<EFBFBD><EFBFBD>
|
|
|
|
|
delayTime:100//<EFBFBD><EFBFBD><EFBFBD>꾭<EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>Ӧ<EFBFBD><EFBFBD><EFBFBD>ӳ<EFBFBD>ʱ<EFBFBD><EFBFBD>
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
$.sGalleryLong = function(e, o) {
|
|
|
|
|
this.options = $.extend({}, settings, o || {});
|
|
|
|
|
var _self = $(e);
|
|
|
|
|
var set = this.options;
|
|
|
|
|
var thumb;
|
|
|
|
|
var size = _self.size();
|
|
|
|
|
var nowIndex = 0; //<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȫ<EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD>
|
|
|
|
|
var index;//<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȫ<EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD>
|
|
|
|
|
var startRun;//Ԥ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>в<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
var delayRun;//Ԥ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>в<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
//<EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD>
|
|
|
|
|
_self.eq(0).show();
|
|
|
|
|
|
|
|
|
|
//<EFBFBD><EFBFBD><EFBFBD>л<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
function fadeAB () {
|
|
|
|
|
if (nowIndex != index) {
|
|
|
|
|
if (set.thumbObj!=null) {
|
|
|
|
|
$(set.thumbObj).removeClass().eq(index).addClass(set.thumbNowClass);}
|
|
|
|
|
_self.eq(nowIndex).stop(false,true).fadeOut(set.slideTime);
|
|
|
|
|
_self.eq(index).stop(true,true).fadeIn(set.slideTime);
|
|
|
|
|
$(set.titleObj).eq(nowIndex).hide();//<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>title
|
|
|
|
|
$(set.titleObj).eq(index).show();//<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>title
|
|
|
|
|
nowIndex = index;
|
|
|
|
|
if (set.autoChange==true) {
|
|
|
|
|
clearInterval(startRun);//<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD><EFBFBD>л<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
startRun = setInterval(runNext,set.changeTime);}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<EFBFBD>л<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD>
|
|
|
|
|
function runNext() {
|
|
|
|
|
index = (nowIndex+1)%size;
|
|
|
|
|
fadeAB();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һͼƬ
|
|
|
|
|
if (set.thumbObj!=null) {
|
|
|
|
|
thumb = $(set.thumbObj);
|
|
|
|
|
//<EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD>
|
|
|
|
|
thumb.eq(0).addClass(set.thumbNowClass);
|
|
|
|
|
thumb.bind("mousemove",function(event){
|
|
|
|
|
index = thumb.index($(this));
|
|
|
|
|
fadeAB();
|
|
|
|
|
delayRun = setTimeout(fadeAB,set.delayTime);
|
|
|
|
|
clearTimeout(delayRun);
|
|
|
|
|
event.stopPropagation();
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD>
|
|
|
|
|
if (set.botNext!=null) {
|
|
|
|
|
var botNext = $(set.botNext);
|
|
|
|
|
botNext.mousemove(function () {
|
|
|
|
|
runNext();
|
|
|
|
|
return false;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD>
|
|
|
|
|
if (set.botLast!=null) {
|
|
|
|
|
var botLast = $(set.botLast);
|
|
|
|
|
botLast.mousemove(function () {
|
|
|
|
|
index = (nowIndex+size-1)%size;
|
|
|
|
|
fadeAB();
|
|
|
|
|
return false;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<EFBFBD>Զ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
if (set.autoChange==true) {
|
|
|
|
|
startRun = setInterval(runNext,set.changeTime);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var $sG = $.sGalleryLong;
|
|
|
|
|
|
|
|
|
|
})(jQuery);
|
|
|
|
|
|
|
|
|
|
function slide(Name,Class,Width,Height,fun){
|
|
|
|
|
$(Name).width(Width);
|
|
|
|
|
$(Name).height(Height);
|
|
|
|
|
|
|
|
|
|
if(fun == true){
|
|
|
|
|
$(Name).append('<div class="title-bg"></div><div class="title"></div><div class="change"></div>')
|
|
|
|
|
var atr = $(Name+' div.changeDiv a');
|
|
|
|
|
var sum = atr.length;
|
|
|
|
|
for(i=1;i<=sum;i++){
|
|
|
|
|
var title = atr.eq(i-1).attr("title");
|
|
|
|
|
var href = atr.eq(i-1).attr("href");
|
|
|
|
|
$(Name+' .change').append('<i>'+i+'</i>');
|
|
|
|
|
$(Name+' .title').append('<a href="'+href+'">'+title+'</a>');
|
|
|
|
|
}
|
|
|
|
|
$(Name+' .change i').eq(0).addClass('cur');
|
|
|
|
|
}
|
|
|
|
|
$(Name+' div.changeDiv a').sGallery({//<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD><EFBFBD>㣬<EFBFBD><EFBFBD><EFBFBD>ڰ<EFBFBD><EFBFBD><EFBFBD>ͼƬ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
titleObj:Name+' div.title a',
|
|
|
|
|
thumbObj:Name+' .change i',
|
|
|
|
|
thumbNowClass:Class
|
|
|
|
|
});
|
|
|
|
|
$(Name+" .title-bg").width(Width);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼ
|
|
|
|
|
jQuery.fn.LoadImage=function(scaling,width,height,loadpic){
|
|
|
|
|
if(loadpic==null)loadpic="../images/msg_img/loading.gif";
|
|
|
|
|
return this.each(function(){
|
|
|
|
|
var t=$(this);
|
|
|
|
|
var src=$(this).attr("src")
|
|
|
|
|
var img=new Image();
|
|
|
|
|
img.src=src;
|
|
|
|
|
//<EFBFBD>Զ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼƬ
|
|
|
|
|
var autoScaling=function(){
|
|
|
|
|
if(scaling){
|
|
|
|
|
if(img.width>0 && img.height>0){
|
|
|
|
|
if(img.width/img.height>=width/height){
|
|
|
|
|
if(img.width>width){
|
|
|
|
|
t.width(width);
|
|
|
|
|
t.height((img.height*width)/img.width);
|
|
|
|
|
}else{
|
|
|
|
|
t.width(img.width);
|
|
|
|
|
t.height(img.height);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
if(img.height>height){
|
|
|
|
|
t.height(height);
|
|
|
|
|
t.width((img.width*height)/img.height);
|
|
|
|
|
}else{
|
|
|
|
|
t.width(img.width);
|
|
|
|
|
t.height(img.height);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ff<EFBFBD>»<EFBFBD><EFBFBD>Զ<EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼƬ
|
|
|
|
|
if(img.complete){
|
|
|
|
|
autoScaling();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
$(this).attr("src","");
|
|
|
|
|
var loading=$("<img alt=\"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>...\" title=\"ͼƬ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>...\" src=\""+loadpic+"\" />");
|
|
|
|
|
|
|
|
|
|
t.hide();
|
|
|
|
|
t.after(loading);
|
|
|
|
|
$(img).load(function(){
|
|
|
|
|
autoScaling();
|
|
|
|
|
loading.remove();
|
|
|
|
|
t.attr("src",this.src);
|
|
|
|
|
t.show();
|
|
|
|
|
//$('.photo_prev a,.photo_next a').height($('#big-pic img').height());
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//<EFBFBD><EFBFBD><EFBFBD>Ϲ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
function startmarquee(elementID,h,n,speed,delay){
|
|
|
|
|
var t = null;
|
|
|
|
|
var box = '#' + elementID;
|
|
|
|
|
$(box).hover(function(){
|
|
|
|
|
clearInterval(t);
|
|
|
|
|
}, function(){
|
|
|
|
|
t = setInterval(start,delay);
|
|
|
|
|
}).trigger('mouseout');
|
|
|
|
|
function start(){
|
|
|
|
|
$(box).children('ul:first').animate({marginTop: '-='+h},speed,function(){
|
|
|
|
|
$(this).css({marginTop:'0'}).find('li').slice(0,n).appendTo(this);
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//TAB<EFBFBD>л<EFBFBD>
|
|
|
|
|
function SwapTab(name,title,content,Sub,cur){
|
|
|
|
|
$(name+' '+title).mouseover(function(){
|
|
|
|
|
$(this).addClass(cur).siblings().removeClass(cur);
|
|
|
|
|
$(content+" > "+Sub).eq($(name+' '+title).index(this)).show().siblings().hide();
|
|
|
|
|
});
|
|
|
|
|
}
|