UNPKG

7.22 kBJavaScriptView Raw
1$(function(){
2
3 /* 上菜单 */
4 $(".hasSub").click(function(e){
5 if($(this).hasClass("hover")){
6 $(this).removeClass("hover").find(".topSub").hide();
7 e.stopPropagation();
8 }
9 else{
10 $(this).addClass("hover").find(".topSub").show();
11 $(this).siblings().removeClass("hover").find(".topSub").hide();
12 e.stopPropagation();
13 }
14 });
15
16 $(".topSub").click(function(e){
17 e.stopPropagation();
18 });
19
20
21 /* 左导航 */
22 $(".slideDiv").click(function(){
23 if($(".sideMenu > ul li").hasClass("current")===false){
24 return;
25 }
26 if($(this).hasClass("on")){
27 $(this).removeClass("on");
28 $(".subMenu").animate({left:"-100px"},"fast");
29 $(".rightCon").animate({"margin-left":"51px"},"fast");
30 }
31 else{
32 $(".subMenu").animate({left:"51px"},"fast");
33 $(".rightCon").animate({"margin-left":"200px"},"fast");
34 $(this).addClass("on");
35 }
36 });
37
38 if($(".sideMenu > ul li").hasClass("current")){
39 var selId = $(".current").attr("rel");
40 $(".subMenu ul#"+selId).css("display","block");
41 $(".subMenu").css({left:"51px"});
42 $(".rightCon").css({"margin-left":"200px"});
43 $(".slideDiv").addClass("on");
44 }
45
46 var navi_idx = 0;
47 $(".sideMenu > ul li").each(function(index, element) {
48 $(element).mouseover(function(){
49 $(".sideMenu").find("mark").css({"top":((index+1) * $(this).height())+"px","left":"0"});
50 if($(this).hasClass("current")){
51 $(".menubg").hide();
52 }
53 else{
54 $(".slideDiv").css("border-right","1px solid #313541")
55 $(".menubg").show();
56 var selId = $(this).attr("rel");
57 var appendHtml=$(".subMenu ul#"+selId).html();
58 $(".menubg ul").html(appendHtml).show().find("a").removeClass("cur");
59 };
60 });
61 $(".sideMenu").mouseleave(function(){
62 $(".sideMenu").find("mark").css({"left":"-50px"});
63 $(".slideDiv").css("border-right","1px solid #313541")
64 $(".menubg").hide();
65 });
66 $(element).click(function(){
67 $(".sideMenu").find("ul").find("li").removeClass("current");
68 $(".subMenu ul").css("display","none");
69 $(this).addClass("current");
70 var selId = $(element).attr("rel");
71 $(".subMenu ul#"+selId).css("display","block");
72 $(".subMenu").css("left","51px");
73 $(".rightCon").css("margin-left","200px");
74 $(".slideDiv").addClass("on");
75 $(".sideMenu").find("mark").css({"top":(index * $(this).height())+"px","left":"0"});
76 navi_idx = index;
77 });
78 });
79
80 //add20170227 左导航slide
81 /*$(".slideIcon-new").click(function(){
82 if($(this).hasClass("fold")){
83 $(this).removeClass("fold");
84 $(".subMenu").animate({left:"0"},"fast");
85 $(".rightCon").animate({"margin-left":"149px"},"fast");
86 }
87 else{
88 $(".subMenu").animate({left:"-149px"},"fast");
89 $(".rightCon").animate({"margin-left":"0"},"fast");
90 $(this).addClass("fold");
91 }
92 });
93 */
94 $(".subMenu li.hassub").click(function(){
95 $(this).toggleClass("current");
96 })
97
98 $(".subMenu li dt a").click(function(e){
99 e.stopPropagation();
100 });
101
102 $(".slide-icon").click(function(){
103 if($(this).hasClass("open")){
104 $(this).removeClass("open").next("ul").slideUp();
105 }
106 else{
107 $(this).addClass("open").next("ul").slideDown();
108 }
109 })
110
111 $('.circle').each(function() {
112 var total=$(this).next(".num").find("i").text();
113 var curNum=$(this).find('span').text();
114 var num = 360/total*curNum;
115 if (num<=180) {
116 $(this).find('.rightArea').css('transform', "rotate(" + num + "deg)");
117 } else {
118 $(this).find('.rightArea').css('transform', "rotate(180deg)");
119 $(this).find('.leftArea').css('transform', "rotate(" + (num - 180) + "deg)");
120 };
121 });
122
123 //公用下拉框
124 $(".dropdown-btn").live("click",function(e){
125 var _parent=$(this).parent();
126 if(_parent.hasClass("open")){
127 _parent.removeClass("open");
128 }
129 else{
130 $(".select-box").removeClass("open");
131 _parent.addClass("open");
132 }
133 e.stopPropagation();
134 });
135
136/* $(".dropdown-list li a").live("click",function(){
137 $(this).parents(".select-box").find(".start-tips").hide();
138 $(this).parents(".select-box").find(".select-value").text($(this).text());
139 });*/
140
141 $(".menu-pd").click(function(e){
142 $(this).toggleClass("hover");
143 e.stopPropagation();
144 });
145 //关闭产品menu
146 $(document).click(function(e){
147 $(".top-dropdown").parent().removeClass("open");
148 $(".select-box").removeClass("open");
149 $(".hasSub,.menu-pd").removeClass("hover");
150 $(".topSub").hide();
151 $(".tag-sub-layer").hide();
152
153 });
154
155
156 //状态筛选
157 $(".filter").hover(function(){
158 $(this).toggleClass("filterOpen");
159 });
160
161 //计费方式
162 /*
163 $(window).scroll(function(){
164 var scrollHeight=$(this).scrollTop();
165 if(scrollHeight>110){
166 $(".priceDiv").css({"position":"fixed","top":"70px","right":"0","width":"17%"});
167 }else{
168 $(".priceDiv").css({"position":"static","width":"21%"});
169 }
170 })
171 */
172
173 $("#chargeStyle .chargeText").click(function(){
174 var curValue;
175 $(this).addClass("chargeSel").find(".radio").addClass("radio-check");
176 $(this).siblings().removeClass("chargeSel").find(".radio").removeClass("radio-check");
177 curValue=$(this).find(".radio").attr("value");
178 if(curValue==1){
179 $("#price1").show();
180 $("#price2").hide();
181 $("#IP_type span").show();
182 }
183 else{
184 $("#price1").hide();
185 $("#price2").show();
186 $("#IP_type span").eq(1).hide();
187 }
188 });
189
190
191
192 //问号提示
193 $(".tips-icon,.tips-text").hover(function(){
194 $(this).css("z-index","20");
195 },function(){
196 $(this).css("z-index","10");
197 });
198
199
200 $(".chargeText").hover(function(){
201 $(this).next().addClass("hover").css("z-index","20");
202 },function(){
203 $(this).next().removeClass("hover").css("z-index","0");
204 });
205
206
207//选择地区
208 $("#local span").click(function(){
209 var self = $(this);
210 if(!self.hasClass('not')){
211 self.addClass("hover").siblings().removeClass("hover");
212 }
213 });
214
215// 标签
216
217$(".tag-filter").click(function(e){
218 $(this).find(".tag-sub-layer").show();
219 e.stopPropagation();
220 });
221
222$(".parents-tag li").hover(function(){
223 var selId=$(this).attr("rel");
224 $(".sub-items ul").css("display","none");
225 $(".sub-items ul#"+selId).css("display","block");
226 });
227
228$(".tag-sub-layer ul li").click(function(){
229 var cur_i = $(this).find("i");
230 if(cur_i.is(":visible")){
231 return;
232 }
233 else{
234 $(this).find("i").show();
235 $(".tag-box").append("<div class='tag'>"+$(this).text()+"<i></i></div>");
236 }
237 });
238
239$(".tag i").live('click',function(){
240 $(this).parent().remove();
241 });
242
243$(".log").mouseover(function(){
244 $(this).addClass("hover");
245 $(".log-show").animate({right:"0"},300);
246 });
247$(".log-show").mouseleave(function(){
248 $(this).animate({right:"-280px",},200);
249 $(".log").removeClass("hover");
250 });
251
252
253 $(document).ready(function(){
254 $('#message_mode > li').click(function(){
255 var _this = $(this);
256 $('.mess').hide();
257 $('.mess'+_this.data('type')).show();
258 });
259 });
260
261});
262
263
264//tab标签
265function setTab(name,cursel,n){
266 for(i=1;i<=n;i++){
267 var menu=document.getElementById(name+i);
268 var con=document.getElementById("con-"+name+"-"+i);
269 menu.className=i==cursel?"hover":"";
270 con.style.display=i==cursel?"block":"none";
271 }
272}
273