...
|
...
|
@@ -5,11 +5,14 @@ |
|
|
*/
|
|
|
window.tmp$ = null;
|
|
|
|
|
|
var $ = require('jquery'),
|
|
|
Swiper = require("yoho-idangerous.swiper");
|
|
|
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,9 +31,6 @@ $.fn.left = function() { |
|
|
}
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$(".lazy").lazyload();
|
|
|
|
|
|
//扩展jquery=================================================================
|
...
|
...
|
@@ -109,7 +109,7 @@ $(".content").click(function() { |
|
|
|
|
|
//企业滚动效果======================================================================================================
|
|
|
var minMenuHasShow = false;
|
|
|
var minMenuHasDropDown=false;
|
|
|
var minMenuHasDropDown = false;
|
|
|
//小导航是否显示
|
|
|
var isTop = true;
|
|
|
var bigMenuHeight = 220;
|
...
|
...
|
@@ -131,16 +131,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({
|
...
|
...
|
@@ -148,16 +141,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) {
|
...
|
...
|
@@ -181,18 +168,20 @@ $(window).scroll(function() { |
|
|
$(document).bind({
|
|
|
mousemove : function(event) {
|
|
|
var scrollTop = $(this).scrollTop();
|
|
|
var mouseY=event.pageY-scrollTop;
|
|
|
if(mouseY<=200&&minMenuHasDropDown===false&&minMenuHasShow===true){
|
|
|
minMenuHasDropDown=true;
|
|
|
|
|
|
$("#minEnterprise").animate({top:37},500);
|
|
|
var mouseY = event.pageY - scrollTop;
|
|
|
if (mouseY <= 200 && minMenuHasDropDown === false && minMenuHasShow === true) {
|
|
|
minMenuHasDropDown = true;
|
|
|
|
|
|
$("#minEnterprise").animate({
|
|
|
top : 37
|
|
|
}, 500);
|
|
|
} else if (minMenuHasDropDown === true && minMenuHasShow === true && mouseY > 200) {
|
|
|
minMenuHasDropDown = false;
|
|
|
$("#minEnterprise").animate({
|
|
|
top : 0
|
|
|
}, 500);
|
|
|
}
|
|
|
else if(minMenuHasDropDown===true&&minMenuHasShow===true&&mouseY>200)
|
|
|
{
|
|
|
minMenuHasDropDown=false;
|
|
|
$("#minEnterprise").animate({top:0},500);
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
});
|
|
|
|
...
|
...
|
@@ -311,18 +300,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) {
|
...
|
...
|
@@ -353,7 +330,7 @@ $(document.body).click(function() { |
|
|
if (clientWidth <= 768) {
|
|
|
target.parent().removeAttr("style");
|
|
|
target.css({
|
|
|
width : "auto"
|
|
|
width : "65px"
|
|
|
});
|
|
|
} else {
|
|
|
target.animate({
|
...
|
...
|
@@ -368,26 +345,27 @@ $(".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() {
|
...
|
...
|
@@ -401,7 +379,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) {
|
...
|
...
|
@@ -411,3 +388,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 |
...
|
...
|
|