You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

102 lines
3.4 KiB
JavaScript

2 years ago
$(function() {
// tab
var $tab = $(".tab_ctrl").children();
$tab.each(function() {
$(this).click(function() {
var tab_index = $tab.index(this);
var $tab_wrap = $(this).parent().next(".tab_wrap");
$(this).addClass("on").siblings().removeClass("on");
$tab_wrap.children().eq(tab_index).show().siblings().hide();
});
});
// title
var $title = $(".title_ctrl").children();
$title.each(function() {
$(this).click(function() {
var title_index = $title.index(this);
var $title_wrap = $(this).parent().next(".title_wrap");
$(this).addClass("on").siblings().removeClass("on");
$title_wrap.children().eq(title_index).show().siblings().hide();
});
});
// flex tab
$(".flex_tab").each(function() {
var tab_length = $(this).children().length;
var tab_wa = 1 / tab_length;
var tab_wb = tab_wa.toFixed(8);
var tab_wc = tab_wb.slice(2, 4) + "." + tab_wb.slice(4, 8) + "%";
$(this).children().width(tab_wc);
});
/*<2A><><EFBFBD><EFBFBD>ȫѡ<C8AB><D1A1>ϵͳ<CFB5><CDB3><EFBFBD>ƹ<EFBFBD><C6B9><EFBFBD>*/
var inputkeyCode=$(".inputkeyCode");
for(var i=0;i<inputkeyCode.length;i++){
(function(i){
inputkeyCode[i].onclick=function(){
this.select();
var values=this.getAttribute("value")
this.oninput=function(){
this.setAttribute("readonly","readonly");
$(this).val(values);
}
}
inputkeyCode[i].onblur=function(){
this.removeAttribute("readonly");
}
})(i)
}
// <20>ж<EFBFBD>ҳ<EFBFBD><D2B3><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD>hot-news<77><73><EFBFBD><EFBFBD>ID<49>Ĵ<EFBFBD><C4B4><EFBFBD>
if (document.getElementById("hot-news")) {
var tips = {
box : document.getElementById("hot-news"),
p : document.getElementById("hot-news").getElementsByTagName("li"),
n : 0,
transEnd : function() {
tips.box.style.cssText = "-webkit-transform:translateY(0px);-webkit-transition: 0ms;";
tips.n = 0;
tips.box.removeEventListener("webkitTransitionEnd", tips.transEnd);
},
tipsInit : function() {
tips.box.appendChild(last);
}
};
var last = (tips.p[0]).cloneNode(true);
tips.tipsInit();
var tipsPlay = setInterval(function() {
tips.n++;
tips.box.style.cssText =
"-webkit-transform:translateY(-" + (tips.n * tips.p[0].offsetHeight)
+ "px);-webkit-transition: 300ms;";
if (tips.n >= tips.p.length - 1) {
tips.box.addEventListener("webkitTransitionEnd", tips.transEnd);
}
}, 5000);
}
});
$(document).ready(function(){
var $newCode=$(".gift-con .newCode");/*<2A><><EFBFBD><EFBFBD><EFBFBD>л<EFBFBD>*/
var $newtGift=$(".gift-con .newtGift");
$newCode.click(function(){
$(this).addClass("on");
$newtGift.removeClass("on");
$("#newCodeList").show();
$("#newGiftList").hide();
imageLoad();
});
$newtGift.click(function(){
$(this).addClass("on");
$newCode.removeClass("on");
$("#newCodeList").hide();
$("#newGiftList").show();
imageLoad();
});
});
/*ͼƬ<CDBC><C6AC>С<EFBFBD><D0A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
window.onload=imageLoad;
function imageLoad() {
$(".dateilImg img").each(function(i){
if($(this).width() > 290){
$(this).width(290);
}
})
}