...
|
...
|
@@ -8,8 +8,14 @@ window.tmp$ = null; |
|
|
var $ = require('jquery'),
|
|
|
Swiper = require("yoho-idangerous.swiper");
|
|
|
require("lazyload");
|
|
|
|
|
|
$(".lazy").lazyload();
|
|
|
|
|
|
//菜单初始化所使用变量
|
|
|
var menuTmpl = $("#menuItemTmpl").html(),
|
|
|
dataKey = null,
|
|
|
mustache = require("mustache");
|
|
|
|
|
|
$.fn.top = function() {
|
|
|
if (arguments.length > 0) {
|
|
|
$(this).css("top", arguments[0]);
|
...
|
...
|
@@ -28,8 +34,6 @@ $.fn.left = function() { |
|
|
}
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
$(".lazy").lazyload();
|
|
|
|
|
|
//扩展jquery=================================================================
|
...
|
...
|
@@ -130,16 +134,9 @@ $(window).scroll(function() { |
|
|
}).show();
|
|
|
minMenuHasShow = true;
|
|
|
$(".enterprise-header-fixed").show();
|
|
|
$(".search-input-box").hide();
|
|
|
$(".home-search-button").hide();
|
|
|
window.isSearching = false;
|
|
|
|
|
|
//$(".search-text").width(73);
|
|
|
$(".search-text").find(".search-text-content").html("Search...");
|
|
|
$(".search-input-box").val("").hide().trigger("blur");
|
|
|
$(".search-area").find(".icons").show();
|
|
|
$(".home-search-button").hide();
|
|
|
window.isSearching = false;
|
|
|
$(document.body).trigger("click");
|
|
|
} else if (scrollTop < 177 && minMenuHasShow === true) {
|
|
|
$(".search-input-box").trigger("blur");
|
|
|
$("#maxEnterprise").css({
|
...
|
...
|
@@ -147,16 +144,10 @@ $(window).scroll(function() { |
|
|
});
|
|
|
$(".enterprise-header-fixed").hide();
|
|
|
$("#minEnterprise").hide();
|
|
|
$(".search-input-box").hide();
|
|
|
$(".home-search-button").hide();
|
|
|
window.isSearching = false;
|
|
|
minMenuHasShow = false;
|
|
|
//搜索归位
|
|
|
$(".search-text").find(".search-text-content").html("Search...");
|
|
|
$(".search-input-box").val("").hide().trigger("blur");
|
|
|
$(".search-area").find(".icons").show();
|
|
|
$(".home-search-button").hide();
|
|
|
window.isSearching = false;
|
|
|
$(document.body).trigger("click");
|
|
|
}
|
|
|
|
|
|
if (scrollTop > 0 && isTop === true) {
|
...
|
...
|
@@ -301,7 +292,7 @@ if (!isIpad && $(".share").size() > 0) { |
|
|
if (shareOffsetTop - scrollTop - navHeight <= 0) {
|
|
|
$(".share").css({
|
|
|
"position": "fixed",
|
|
|
"top": navHeight + 10
|
|
|
"top": navHeight
|
|
|
});
|
|
|
} else {
|
|
|
$(".share").css({
|
...
|
...
|
@@ -312,18 +303,6 @@ if (!isIpad && $(".share").size() > 0) { |
|
|
});
|
|
|
}
|
|
|
|
|
|
window.scrollWindow = function() {
|
|
|
if (document.body.clientWidth >= 1190) {
|
|
|
//document.body.scrollTop=850;
|
|
|
window.tmp$(window).scrollTop(850);
|
|
|
|
|
|
} else if (document.body.clientWidth < 1190 && document.body.clientWidth > 768) {
|
|
|
window.tmp$(window).scrollTop(700);
|
|
|
|
|
|
} else if (document.body.clientWidth <= 768) {
|
|
|
window.tmp$(window).scrollTop(600);
|
|
|
}
|
|
|
};
|
|
|
//搜索按钮===========================================================================
|
|
|
var clientWidth = $(window).width();
|
|
|
$(".search-input-box").keypress(function(event) {
|
...
|
...
|
@@ -354,7 +333,7 @@ $(document.body).click(function() { |
|
|
if (clientWidth <= 768) {
|
|
|
target.parent().removeAttr("style");
|
|
|
target.css({
|
|
|
width: "auto"
|
|
|
width: "65px"
|
|
|
});
|
|
|
} else {
|
|
|
target.animate({
|
...
|
...
|
@@ -369,26 +348,28 @@ $(".search-text").click(function() { |
|
|
});
|
|
|
|
|
|
$(".search-text").click(function() {
|
|
|
var clientWidth = document.body.clientWidth,
|
|
|
parent = null;
|
|
|
$(this).find(".search-text-content").hide();
|
|
|
|
|
|
parent = $(this).parent();
|
|
|
if (clientWidth <= 768) {
|
|
|
$(this).parent().width(131);
|
|
|
$(this).find(".home-search-button").show();
|
|
|
$(this).find(".search-input-box").width(80).val("").show();
|
|
|
$(this).find(".search-input-box").focus();
|
|
|
parent.width(131);
|
|
|
parent.find(".home-search-button").show();
|
|
|
parent.find(".search-input-box").width(80).val("").show();
|
|
|
parent.find(".search-input-box").focus();
|
|
|
$(this).width(120);
|
|
|
} else if (clientWidth >= 924 && clientWidth < 1080) {
|
|
|
$(this).parent().width(198);
|
|
|
$(this).find(".search-input-box").width(150).val("").show();
|
|
|
} else if (clientWidth >= 924 && clientWidth < 1190) {
|
|
|
parent.width(198);
|
|
|
parent.find(".search-input-box").width(150).val("").show();
|
|
|
$(this).animate({
|
|
|
width: 190
|
|
|
}, 500, function() {
|
|
|
$(this).find(".home-search-button").show();
|
|
|
$(this).find(".search-input-box").focus();
|
|
|
});
|
|
|
} else {
|
|
|
$(this).parent().width(218);
|
|
|
$(this).find(".search-input-box").width(150).val("").show();
|
|
|
} else if (clientWidth >= 1190) {
|
|
|
parent.width(218);
|
|
|
parent.find(".search-input-box").width(150).val("").show();
|
|
|
$(this).animate({
|
|
|
width: 190
|
|
|
}, 500, function() {
|
...
|
...
|
@@ -402,7 +383,6 @@ $(".search-text").click(function() { |
|
|
|
|
|
window.scrollWindow = function() {
|
|
|
if (document.body.clientWidth >= 1190) {
|
|
|
//document.body.scrollTop=850;
|
|
|
window.tmp$(window).scrollTop(850);
|
|
|
|
|
|
} else if (document.body.clientWidth < 1190 && document.body.clientWidth > 768) {
|
...
|
...
|
@@ -412,3 +392,25 @@ window.scrollWindow = function() { |
|
|
window.tmp$(window).scrollTop(600);
|
|
|
}
|
|
|
};
|
|
|
|
|
|
//初始化菜单============================================================================
|
|
|
|
|
|
$.ajax({
|
|
|
url: "http://newgirls.test.yoho.cn/default/default/getnewest",
|
|
|
dataType: "jsonp",
|
|
|
jsonp: "callback",
|
|
|
success: function(tmp) {
|
|
|
var data = tmp.data,
|
|
|
dataKey = null,
|
|
|
mustacheHtml = null,
|
|
|
_html = null;
|
|
|
for (dataKey in data) {
|
|
|
mustacheHtml = mustache.render(menuTmpl, data);
|
|
|
_html = $(".submenu-" + dataKey).html();
|
|
|
$(".submenu-" + dataKey).html(mustacheHtml + _html);
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
});
|
|
|
//==================================================================================== |
|
|
\ No newline at end of file |
...
|
...
|
|