|
@@ -8,8 +8,14 @@ window.tmp$ = null; |
|
@@ -8,8 +8,14 @@ window.tmp$ = null; |
8
|
var $ = require('jquery'),
|
8
|
var $ = require('jquery'),
|
9
|
Swiper = require("yoho-idangerous.swiper");
|
9
|
Swiper = require("yoho-idangerous.swiper");
|
10
|
require("lazyload");
|
10
|
require("lazyload");
|
|
|
11
|
+
|
11
|
$(".lazy").lazyload();
|
12
|
$(".lazy").lazyload();
|
12
|
|
13
|
|
|
|
14
|
+//菜单初始化所使用变量
|
|
|
15
|
+var menuTmpl = $("#menuItemTmpl").html(),
|
|
|
16
|
+ dataKey = null,
|
|
|
17
|
+ mustache = require("mustache");
|
|
|
18
|
+
|
13
|
$.fn.top = function() {
|
19
|
$.fn.top = function() {
|
14
|
if (arguments.length > 0) {
|
20
|
if (arguments.length > 0) {
|
15
|
$(this).css("top", arguments[0]);
|
21
|
$(this).css("top", arguments[0]);
|
|
@@ -28,8 +34,6 @@ $.fn.left = function() { |
|
@@ -28,8 +34,6 @@ $.fn.left = function() { |
28
|
}
|
34
|
}
|
29
|
};
|
35
|
};
|
30
|
|
36
|
|
31
|
-
|
|
|
32
|
-
|
|
|
33
|
$(".lazy").lazyload();
|
37
|
$(".lazy").lazyload();
|
34
|
|
38
|
|
35
|
//扩展jquery=================================================================
|
39
|
//扩展jquery=================================================================
|
|
@@ -130,16 +134,9 @@ $(window).scroll(function() { |
|
@@ -130,16 +134,9 @@ $(window).scroll(function() { |
130
|
}).show();
|
134
|
}).show();
|
131
|
minMenuHasShow = true;
|
135
|
minMenuHasShow = true;
|
132
|
$(".enterprise-header-fixed").show();
|
136
|
$(".enterprise-header-fixed").show();
|
133
|
- $(".search-input-box").hide();
|
|
|
134
|
- $(".home-search-button").hide();
|
|
|
135
|
window.isSearching = false;
|
137
|
window.isSearching = false;
|
136
|
|
138
|
|
137
|
- //$(".search-text").width(73);
|
|
|
138
|
- $(".search-text").find(".search-text-content").html("Search...");
|
|
|
139
|
- $(".search-input-box").val("").hide().trigger("blur");
|
|
|
140
|
- $(".search-area").find(".icons").show();
|
|
|
141
|
- $(".home-search-button").hide();
|
|
|
142
|
- window.isSearching = false;
|
139
|
+ $(document.body).trigger("click");
|
143
|
} else if (scrollTop < 177 && minMenuHasShow === true) {
|
140
|
} else if (scrollTop < 177 && minMenuHasShow === true) {
|
144
|
$(".search-input-box").trigger("blur");
|
141
|
$(".search-input-box").trigger("blur");
|
145
|
$("#maxEnterprise").css({
|
142
|
$("#maxEnterprise").css({
|
|
@@ -147,16 +144,10 @@ $(window).scroll(function() { |
|
@@ -147,16 +144,10 @@ $(window).scroll(function() { |
147
|
});
|
144
|
});
|
148
|
$(".enterprise-header-fixed").hide();
|
145
|
$(".enterprise-header-fixed").hide();
|
149
|
$("#minEnterprise").hide();
|
146
|
$("#minEnterprise").hide();
|
150
|
- $(".search-input-box").hide();
|
|
|
151
|
- $(".home-search-button").hide();
|
|
|
152
|
window.isSearching = false;
|
147
|
window.isSearching = false;
|
153
|
minMenuHasShow = false;
|
148
|
minMenuHasShow = false;
|
154
|
//搜索归位
|
149
|
//搜索归位
|
155
|
- $(".search-text").find(".search-text-content").html("Search...");
|
|
|
156
|
- $(".search-input-box").val("").hide().trigger("blur");
|
|
|
157
|
- $(".search-area").find(".icons").show();
|
|
|
158
|
- $(".home-search-button").hide();
|
|
|
159
|
- window.isSearching = false;
|
150
|
+ $(document.body).trigger("click");
|
160
|
}
|
151
|
}
|
161
|
|
152
|
|
162
|
if (scrollTop > 0 && isTop === true) {
|
153
|
if (scrollTop > 0 && isTop === true) {
|
|
@@ -282,13 +273,13 @@ function getBrowType() { |
|
@@ -282,13 +273,13 @@ function getBrowType() { |
282
|
var info = {};
|
273
|
var info = {};
|
283
|
var sUserAgent = navigator.userAgent.toLowerCase();
|
274
|
var sUserAgent = navigator.userAgent.toLowerCase();
|
284
|
info.bIsIpad = sUserAgent.match(/ipad/i) == "ipad";
|
275
|
info.bIsIpad = sUserAgent.match(/ipad/i) == "ipad";
|
285
|
- // info.bIsIphoneOs = sUserAgent.match(/iphone os/i) == "iphone os";
|
|
|
286
|
- // info.bIsMidp = sUserAgent.match(/midp/i) == "midp";
|
|
|
287
|
- // info.bIsUc7 = sUserAgent.match(/rv:1.2.3.4/i) == "rv:1.2.3.4";
|
|
|
288
|
- // info.bIsUc = sUserAgent.match(/ucweb/i) == "ucweb";
|
|
|
289
|
- // info.bIsAndroid = sUserAgent.match(/android/i) == "android";
|
|
|
290
|
- // info.bIsCE = sUserAgent.match(/windows ce/i) == "windows ce";
|
|
|
291
|
- // info.bIsWM = sUserAgent.match(/windows mobile/i) == "windows mobile";
|
276
|
+ // info.bIsIphoneOs = sUserAgent.match(/iphone os/i) == "iphone os";
|
|
|
277
|
+ // info.bIsMidp = sUserAgent.match(/midp/i) == "midp";
|
|
|
278
|
+ // info.bIsUc7 = sUserAgent.match(/rv:1.2.3.4/i) == "rv:1.2.3.4";
|
|
|
279
|
+ // info.bIsUc = sUserAgent.match(/ucweb/i) == "ucweb";
|
|
|
280
|
+ // info.bIsAndroid = sUserAgent.match(/android/i) == "android";
|
|
|
281
|
+ // info.bIsCE = sUserAgent.match(/windows ce/i) == "windows ce";
|
|
|
282
|
+ // info.bIsWM = sUserAgent.match(/windows mobile/i) == "windows mobile";
|
292
|
return info;
|
283
|
return info;
|
293
|
}
|
284
|
}
|
294
|
|
285
|
|
|
@@ -301,7 +292,7 @@ if (!isIpad && $(".share").size() > 0) { |
|
@@ -301,7 +292,7 @@ if (!isIpad && $(".share").size() > 0) { |
301
|
if (shareOffsetTop - scrollTop - navHeight <= 0) {
|
292
|
if (shareOffsetTop - scrollTop - navHeight <= 0) {
|
302
|
$(".share").css({
|
293
|
$(".share").css({
|
303
|
"position": "fixed",
|
294
|
"position": "fixed",
|
304
|
- "top": navHeight + 10
|
295
|
+ "top": navHeight
|
305
|
});
|
296
|
});
|
306
|
} else {
|
297
|
} else {
|
307
|
$(".share").css({
|
298
|
$(".share").css({
|
|
@@ -312,18 +303,6 @@ if (!isIpad && $(".share").size() > 0) { |
|
@@ -312,18 +303,6 @@ if (!isIpad && $(".share").size() > 0) { |
312
|
});
|
303
|
});
|
313
|
}
|
304
|
}
|
314
|
|
305
|
|
315
|
-window.scrollWindow = function() {
|
|
|
316
|
- if (document.body.clientWidth >= 1190) {
|
|
|
317
|
- //document.body.scrollTop=850;
|
|
|
318
|
- window.tmp$(window).scrollTop(850);
|
|
|
319
|
-
|
|
|
320
|
- } else if (document.body.clientWidth < 1190 && document.body.clientWidth > 768) {
|
|
|
321
|
- window.tmp$(window).scrollTop(700);
|
|
|
322
|
-
|
|
|
323
|
- } else if (document.body.clientWidth <= 768) {
|
|
|
324
|
- window.tmp$(window).scrollTop(600);
|
|
|
325
|
- }
|
|
|
326
|
-};
|
|
|
327
|
//搜索按钮===========================================================================
|
306
|
//搜索按钮===========================================================================
|
328
|
var clientWidth = $(window).width();
|
307
|
var clientWidth = $(window).width();
|
329
|
$(".search-input-box").keypress(function(event) {
|
308
|
$(".search-input-box").keypress(function(event) {
|
|
@@ -354,7 +333,7 @@ $(document.body).click(function() { |
|
@@ -354,7 +333,7 @@ $(document.body).click(function() { |
354
|
if (clientWidth <= 768) {
|
333
|
if (clientWidth <= 768) {
|
355
|
target.parent().removeAttr("style");
|
334
|
target.parent().removeAttr("style");
|
356
|
target.css({
|
335
|
target.css({
|
357
|
- width: "auto"
|
336
|
+ width: "65px"
|
358
|
});
|
337
|
});
|
359
|
} else {
|
338
|
} else {
|
360
|
target.animate({
|
339
|
target.animate({
|
|
@@ -369,26 +348,28 @@ $(".search-text").click(function() { |
|
@@ -369,26 +348,28 @@ $(".search-text").click(function() { |
369
|
});
|
348
|
});
|
370
|
|
349
|
|
371
|
$(".search-text").click(function() {
|
350
|
$(".search-text").click(function() {
|
|
|
351
|
+ var clientWidth = document.body.clientWidth,
|
|
|
352
|
+ parent = null;
|
372
|
$(this).find(".search-text-content").hide();
|
353
|
$(this).find(".search-text-content").hide();
|
373
|
-
|
354
|
+ parent = $(this).parent();
|
374
|
if (clientWidth <= 768) {
|
355
|
if (clientWidth <= 768) {
|
375
|
- $(this).parent().width(131);
|
|
|
376
|
- $(this).find(".home-search-button").show();
|
|
|
377
|
- $(this).find(".search-input-box").width(80).val("").show();
|
|
|
378
|
- $(this).find(".search-input-box").focus();
|
356
|
+ parent.width(131);
|
|
|
357
|
+ parent.find(".home-search-button").show();
|
|
|
358
|
+ parent.find(".search-input-box").width(80).val("").show();
|
|
|
359
|
+ parent.find(".search-input-box").focus();
|
379
|
$(this).width(120);
|
360
|
$(this).width(120);
|
380
|
- } else if (clientWidth >= 924 && clientWidth < 1080) {
|
|
|
381
|
- $(this).parent().width(198);
|
|
|
382
|
- $(this).find(".search-input-box").width(150).val("").show();
|
361
|
+ } else if (clientWidth >= 924 && clientWidth < 1190) {
|
|
|
362
|
+ parent.width(198);
|
|
|
363
|
+ parent.find(".search-input-box").width(150).val("").show();
|
383
|
$(this).animate({
|
364
|
$(this).animate({
|
384
|
width: 190
|
365
|
width: 190
|
385
|
}, 500, function() {
|
366
|
}, 500, function() {
|
386
|
$(this).find(".home-search-button").show();
|
367
|
$(this).find(".home-search-button").show();
|
387
|
$(this).find(".search-input-box").focus();
|
368
|
$(this).find(".search-input-box").focus();
|
388
|
});
|
369
|
});
|
389
|
- } else {
|
|
|
390
|
- $(this).parent().width(218);
|
|
|
391
|
- $(this).find(".search-input-box").width(150).val("").show();
|
370
|
+ } else if (clientWidth >= 1190) {
|
|
|
371
|
+ parent.width(218);
|
|
|
372
|
+ parent.find(".search-input-box").width(150).val("").show();
|
392
|
$(this).animate({
|
373
|
$(this).animate({
|
393
|
width: 190
|
374
|
width: 190
|
394
|
}, 500, function() {
|
375
|
}, 500, function() {
|
|
@@ -402,7 +383,6 @@ $(".search-text").click(function() { |
|
@@ -402,7 +383,6 @@ $(".search-text").click(function() { |
402
|
|
383
|
|
403
|
window.scrollWindow = function() {
|
384
|
window.scrollWindow = function() {
|
404
|
if (document.body.clientWidth >= 1190) {
|
385
|
if (document.body.clientWidth >= 1190) {
|
405
|
- //document.body.scrollTop=850;
|
|
|
406
|
window.tmp$(window).scrollTop(850);
|
386
|
window.tmp$(window).scrollTop(850);
|
407
|
|
387
|
|
408
|
} else if (document.body.clientWidth < 1190 && document.body.clientWidth > 768) {
|
388
|
} else if (document.body.clientWidth < 1190 && document.body.clientWidth > 768) {
|
|
@@ -411,4 +391,26 @@ window.scrollWindow = function() { |
|
@@ -411,4 +391,26 @@ window.scrollWindow = function() { |
411
|
} else if (document.body.clientWidth <= 768) {
|
391
|
} else if (document.body.clientWidth <= 768) {
|
412
|
window.tmp$(window).scrollTop(600);
|
392
|
window.tmp$(window).scrollTop(600);
|
413
|
}
|
393
|
}
|
414
|
-}; |
|
|
|
|
394
|
+};
|
|
|
395
|
+
|
|
|
396
|
+//初始化菜单============================================================================
|
|
|
397
|
+
|
|
|
398
|
+$.ajax({
|
|
|
399
|
+ url: "http://newgirls.test.yoho.cn/default/default/getnewest",
|
|
|
400
|
+ dataType: "jsonp",
|
|
|
401
|
+ jsonp: "callback",
|
|
|
402
|
+ success: function(tmp) {
|
|
|
403
|
+ var data = tmp.data,
|
|
|
404
|
+ dataKey = null,
|
|
|
405
|
+ mustacheHtml = null,
|
|
|
406
|
+ _html = null;
|
|
|
407
|
+ for (dataKey in data) {
|
|
|
408
|
+ mustacheHtml = mustache.render(menuTmpl, data);
|
|
|
409
|
+ _html = $(".submenu-" + dataKey).html();
|
|
|
410
|
+ $(".submenu-" + dataKey).html(mustacheHtml + _html);
|
|
|
411
|
+ }
|
|
|
412
|
+
|
|
|
413
|
+
|
|
|
414
|
+ }
|
|
|
415
|
+});
|
|
|
416
|
+//==================================================================================== |