/*鍏ㄧ珯鎼滅储*/
var input = $("#keyword");
input.focus(function() {
if ($(this).val() == '璇疯緭鍏ユ悳绱㈠叧閿瘝') {
$(this).val('');
}
});
input.blur(function() {
if ($(this).val() == '') {
$(this).val('璇疯緭鍏ユ悳绱㈠叧閿瘝');
}
});
$("#s_btn").click(function() {
if (input.val() == '' || input.val() == '璇疯緭鍏ユ悳绱㈠叧閿瘝') {
alert("璇疯緭鍏ュ叧閿瘝锛?);
input.focus();
return false;
}
});
//璇︾粏椤靛垎椤电偣鍑绘晥鏋
$(".paging_num > a").click(function() {
var index = $(this).index();
location.hash = index + 1;
var hash = location.hash;
$(".total .paging").eq(hash.slice(1) - 1).css("display", "block").siblings().css("display", "none");
$(this).addClass("paging_hover").siblings().removeClass("paging_hover");
});
var hash = location.hash;
if (!hash) {
$(".total .paging").eq(0).css("display", "block").siblings().css("display", "none");
} else {
$(".total .paging").eq(hash.slice(1) - 1).css("display", "block").siblings().css("display", "none");
$(".paging_num > a").eq(hash.slice(1) - 1).addClass("paging_hover").siblings().removeClass("paging_hover");
}
//璁句负棣栭〉
function SetHome(obj, vrl) {
try {
obj.style.behavior = 'url(#default#homepage)';
obj.setHomePage(vrl);
} catch (e) {
if (window.netscape) {
try {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
} catch (e) {
alert("鎶辨瓑锛佹偍鐨勬祻瑙堝櫒涓嶆敮鎸佺洿鎺ヨ涓洪椤点€傝鍦ㄦ祻瑙堝櫒鍦板潃鏍忚緭鍏モ€渁bout:config鈥濆苟鍥炶溅鐒跺悗灏哰signed.applets.codebase_principal_support]璁剧疆涓衡€渢rue鈥濓紝鐐瑰嚮鈥滃姞鍏ユ敹钘忊€濆悗蹇界暐瀹夊叏鎻愮ず锛屽嵆鍙缃垚鍔熴€?);
}
var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch);
prefs.setCharPref('browser.startup.homepage', vrl);
} else {
alert('鎶辨瓑锛屾偍鐨勬祻瑙堝櫒涓嶆敮鎸佽嚜鍔ㄨ缃椤? 璇蜂娇鐢ㄦ祻瑙堝櫒鑿滃崟鎵嬪姩璁剧疆!');
}
}
}
//banner1 - 澶氬浘
function bb1() {
var nav_num = '';
var obj_li = $(".bb li");
var count = obj_li.length;
obj_li.first().css("display", "block");
obj_li.each(function() {
var index = $(this).index() + 1;
nav_num += '
' + index + '';
});
$(".banner").append('');
$(".num li").first().addClass("num_hover");
$(".num li").hover(function() {
sw = $(".num li").index(this);
myShow(sw);
});
function myShow(i) {
$(".num li").eq(i).addClass("num_hover").siblings().removeClass("num_hover");
obj_li.eq(i).stop(true, true).fadeIn(600).siblings("li").fadeOut(600);
}
var myTime = 0;
//婊戝叆鍋滄鍔ㄧ敾锛屾粦鍑哄紑濮嬪姩鐢
$(".bb").hover(function() {
if (myTime) {
clearInterval(myTime);
}
}, function() {
myTime = setInterval(function() {
myShow(sw);
sw++;
if (sw == count) {
sw = 0;
}
}, 3000);
});
//鑷姩寮€濮
var sw = 0;
myTime = setInterval(function() {
myShow(sw);
sw++;
if (sw == count) {
sw = 0;
}
}, 2000);
}
//banner2 - 澶氬浘
function bb2() {
var sWidth = $("#focus").width(); //鑾峰彇鐒︾偣鍥剧殑瀹藉害锛堟樉绀洪潰绉級
var len = $("#focus ul li").length; //鑾峰彇鐒︾偣鍥句釜鏁
var index = 0;
var picTimer = 0;
//浠ヤ笅浠g爜娣诲姞鏁板瓧鎸夐挳鍜屾寜閽悗鐨勫崐閫忔槑鏉★紝杩樻湁涓婁竴椤点€佷笅涓€椤典袱涓寜閽
var btn = "";
for (var i = 0; i < len; i++) {
btn += "";
}
btn += "
";
$("#focus").append(btn);
$("#focus .btnBg").css("opacity", 0.5);
$("#focus .btnBg").css("filter", "alpha(opacity=60)");
//涓哄皬鎸夐挳娣诲姞榧犳爣婊戝叆浜嬩欢锛屼互鏄剧ず鐩稿簲鐨勫唴瀹
$("#focus .btn span").css("opacity", 0.4).mouseenter(function() {
index = $("#focus .btn span").index(this);
showPics(index);
}).eq(0).trigger("mouseenter");
//涓婁竴椤垫寜閽
$("#focus .pre").click(function() {
index -= 1;
if (index == -1) { index = len - 1; }
showPics(index);
});
//涓嬩竴椤垫寜閽
$("#focus .next").click(function() {
index += 1;
if (index == len) { index = 0; }
showPics(index);
});
//鏈緥涓哄乏鍙虫粴鍔紝鍗虫墍鏈塴i鍏冪礌閮芥槸鍦ㄥ悓涓€鎺掑悜宸︽诞鍔紝鎵€浠ヨ繖閲岄渶瑕佽绠楀嚭澶栧洿ul鍏冪礌鐨勫搴
$("#focus ul").css("width", sWidth * (len));
//榧犳爣婊戜笂鐒︾偣鍥炬椂鍋滄鑷姩鎾斁锛屾粦鍑烘椂寮€濮嬭嚜鍔ㄦ挱鏀
$("#focus").hover(function() {
clearInterval(picTimer);
}, function() {
picTimer = setInterval(function() {
showPics(index);
index++;
if (index == len) { index = 0; }
}, 4000); //姝?000浠h〃鑷姩鎾斁鐨勯棿闅旓紝鍗曚綅锛氭绉
}).trigger("mouseleave");
//鏄剧ず鍥剧墖鍑芥暟锛屾牴鎹帴鏀剁殑index鍊兼樉绀虹浉搴旂殑鍐呭
function showPics(index) { //鏅€氬垏鎹
var nowLeft = -index * sWidth; //鏍规嵁index鍊艰绠梪l鍏冪礌鐨刲eft鍊
$("#focus ul").stop(true, false).animate({ "left": nowLeft }, 300); //閫氳繃animate()璋冩暣ul鍏冪礌婊氬姩鍒拌绠楀嚭鐨刾osition
$("#focus .btn span").stop(true, false).animate({ "opacity": "0.4" }, 300).eq(index).stop(true, false).animate({ "opacity": "1" }, 300); //涓哄綋鍓嶇殑鎸夐挳鍒囨崲鍒伴€変腑鐨勬晥鏋
}
}
//澶氶〉绛
function tabs(tabs, tab_box, _event) {
$(tab_box).hide();
$(tab_box).eq(0).show();
$(tabs).find('li:eq(0)').addClass('cur');
$(tabs).find("li").bind(_event, function() {
$(this).addClass("cur").siblings("li").removeClass("cur");
var _index = $(this).index();
$(tab_box).eq(_index).show().siblings(tab_box).hide();
});
};
//婊氬姩
function scroll() {
//浜у搧婊氬姩
var speed = 30; //鏁板瓧瓒婂ぇ閫熷害瓒婃參
var tab = document.getElementById("demo");
var tab1 = document.getElementById("demo1");
var tab2 = document.getElementById("demo2");
var liwidth = tab1.getElementsByTagName("li");
var liwidths = liwidth[0].offsetWidth;
var length = $("#demo1 li").length;
var mleft = parseInt($("#demo1 li:eq(0)").css("marginLeft"));
var mright = parseInt($("#demo1 li:eq(0)").css("marginRight"));
var totalwidth = (liwidths + mleft + mright) * length * 2 + 300;
$("#indemo").width(totalwidth);
tab2.innerHTML = tab1.innerHTML;
function Marquee() {
if (tab2.offsetWidth - tab.scrollLeft <= 0)
tab.scrollLeft -= tab1.offsetWidth;
else {
tab.scrollLeft++;
}
}
var MyMar = setInterval(Marquee, speed);
tab.onmouseover = function() {
clearInterval(MyMar);
};
tab.onmouseout = function() {
MyMar = setInterval(Marquee, speed);
};
}
//婊氬姩
function scroll2() {
//浜у搧婊氬姩
var speed = 30; //鏁板瓧瓒婂ぇ閫熷害瓒婃參
var tab = document.getElementById("m_demo");
var tab1 = document.getElementById("m_demo1");
var tab2 = document.getElementById("m_demo2");
var liwidth = tab1.getElementsByTagName("li");
var liwidths = liwidth[0].offsetWidth;
var length = $("#m_demo1 li").length;
var mleft = parseInt($("#m_demo1 li:eq(0)").css("marginLeft"));
var mright = parseInt($("#m_demo1 li:eq(0)").css("marginRight"));
var totalwidth = (liwidths + mleft + mright) * length * 2 + 300;
$("#m_indemo").width(totalwidth);
tab2.innerHTML = tab1.innerHTML;
function Marquee() {
if (tab2.offsetWidth - tab.scrollLeft <= 0)
tab.scrollLeft -= tab1.offsetWidth;
else {
tab.scrollLeft++;
}
}
var MyMar = setInterval(Marquee, speed);
tab.onmouseover = function() {
clearInterval(MyMar);
};
tab.onmouseout = function() {
MyMar = setInterval(Marquee, speed);
};
}
// 鏂伴椈瀹氭椂鎺ㄩ€
(function() {
if (typeof(url) != 'undefined') {
$.get(url + "data/include/exectask.php?rand" + Math.random());
} else {
$.get("/data/include/exectask.php?rand" + Math.random());
}
})();
//鐧惧害鑷姩鎺ㄩ€佷唬鐮
(function() {
var bp = document.createElement('script');
var curProtocol = window.location.protocol.split(':')[0];
if (curProtocol === 'https') {
bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';
} else {
bp.src = 'http://push.zhanzhang.baidu.com/push.js';
}
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(bp, s);
})();
function tabs(tabs, tab_box, _event) {
$(tab_box).hide();
$(tab_box).eq(0).show();
$(tabs).find('li:eq(0)').addClass('cur');
$(tabs).find("li").bind(_event, function() {
$(this).addClass("cur").siblings("li").removeClass("cur");
var _index = $(this).index();
$(tab_box).eq(_index).show().siblings(tab_box).hide();
});
};
/**
* 浜у搧涓婁笅宸﹀彸婊氬姩
*/
(function($) {
$.fn.rollSlide = function(obj) {
var $self = this,
orientation = obj.orientation || 'left',
num = obj.num || 1,
v = (typeof obj.v === 'number') ? obj.v : 0,
minTime = (typeof obj.space === 'number') ? ((obj.space >= 100) ? obj.space : 100) : 100,
space = minTime + v || 5000 + v,
isRoll = obj.isRoll,
isStart = true,
roll = function(ori, n, v) {
var $ul = $self.find('.roll__list'),
$item = $ul.find('li'),
range = 0,
i, len = $item.length,
sliceItem = [],
cloneSliceItem = [],
startTime = (new Date()).getTime(),
memory = function() {
var arr = [];
if (ori === 'left' || ori === 'top') {
for (i = 0; i < n; i++) {
range += ori === 'left' ? $($item[i]).outerWidth(true) : $($item[i]).outerHeight(true);
arr.push($item[i]);
}
} else if (ori === 'right' || ori === 'bottom') {
for (i = len - n; n > 0; n--, i++) {
range += ori === 'right' ? $($item[i]).outerWidth(true) : $($item[i]).outerHeight(true);
arr.push($item[i]);
}
}
return arr;
};
isStart = false;
sliceItem = memory();
cloneSliceItem = $(sliceItem).clone();
switch (ori) {
case 'left':
$ul.append(cloneSliceItem);
$ul.animate({
'left': -range + 'px'
}, v, function() {
$(this).css({
'left': 0
});
$(sliceItem).remove();
isStart = true;
});
break;
case 'right':
$ul.prepend(cloneSliceItem);
$ul.css('left', -range + 'px');
$ul.animate({
'left': 0
}, v, function() {
$(sliceItem).remove();
isStart = true;
});
break;
case 'top':
$ul.append(cloneSliceItem);
$ul.animate({
'top': -range + 'px'
}, v, function() {
$(this).css({
'top': 0
});
$(sliceItem).remove();
isStart = true;
});
break;
case 'bottom':
$ul.prepend(cloneSliceItem);
$ul.css('top', -range + 'px');
$ul.animate({
'top': 0
}, v, function() {
$(sliceItem).remove();
isStart = true;
});
break;
}
},
init = function() {
var $ul = $self.find('.roll__list'),
$item = $ul.find('li'),
len = $item.length,
timer;
num = num <= len ? num : len;
if (len > 1) {
$self.on('click', '.pre', function() {
if (isStart) {
if (orientation === 'left' || orientation === 'right') {
roll('right', num, v);
} else {
roll('bottom', num, v);
}
}
}).
on('click', '.next', function() {
if (isStart) {
if (orientation === 'left' || orientation === 'right') {
roll('left', num, v);
} else {
roll('top', num, v);
}
}
}).
hover(function() {
clearInterval(timer);
}, function() {
if (isRoll) {
timer = setInterval(function() {
roll(orientation, num, v);
}, space);
}
}).
trigger('mouseout');
}
};
init();
};
$.fn.rollNoInterval = function() {
var $self = this,
$ul = $self.find('.roll__list'),
$item = $ul.find('li'),
len = $item.length,
timer,
left = function() {
var offset, i,
range,
$sliceItem;
$sliceItem = $($item[0]);
range = $sliceItem.outerWidth(true);
timer = setInterval(function() {
offset = $ul.css('left');
offset = parseInt(offset);
if (offset > -range) {
i = offset - 1;
$ul.css('left', i + 'px');
offset = $ul.css('left');
} else {
$sliceItem.detach();
$ul.css('left', 0);
$ul.append($sliceItem);
$sliceItem = $($ul.find('li')[0]);
range = $sliceItem.outerWidth(true);
}
}, 50);
},
right = function() {
var offset, i,
range,
$sliceItem;
$sliceItem = $($item[len - 1]);
range = $sliceItem.outerWidth(true);
timer = setInterval(function() {
offset = $ul.css('right');
offset = parseInt(offset);
if (offset > -range) {
i = offset - 1;
$ul.css('right', i + 'px');
offset = $ul.css('right');
} else {
$sliceItem.detach();
$ul.css('right', 0);
$ul.prepend($sliceItem);
$sliceItem = $($ul.find('li')[len - 1]);
range = $sliceItem.outerWidth(true);
}
}, 50);
},
top = function() {
var offset, i,
range,
$sliceItem;
$sliceItem = $($item[0]);
range = $sliceItem.outerHeight(true);
timer = setInterval(function() {
offset = $ul.css('top');
offset = parseInt(offset);
if (offset > -range) {
i = offset - 1;
$ul.css('top', i + 'px');
offset = $ul.css('top');
} else {
$sliceItem.detach();
$ul.css('top', 0);
$ul.append($sliceItem);
$sliceItem = $($ul.find('li')[0]);
range = $sliceItem.outerHeight(true);
}
}, 50);
},
bottom = function() {
var offset, i,
range,
$sliceItem;
$sliceItem = $($item[len - 1]);
range = $sliceItem.outerHeight(true);
timer = setInterval(function() {
offset = $ul.css('bottom');
offset = parseInt(offset);
if (offset > -range) {
i = offset - 1;
$ul.css('bottom', i + 'px');
offset = $ul.css('bottom');
} else {
$sliceItem.detach();
$ul.css('bottom', 0);
$ul.prepend($sliceItem);
$sliceItem = $($ul.find('li')[len - 1]);
range = $sliceItem.outerHeight(true);
}
}, 50);
},
init = function() {
$self.hover(function() {
clearInterval(timer);
}, function() {
});
};
//init();
return {
left: left,
right: right,
top: top,
bottom: bottom
}
}
})(jQuery);