...
|
...
|
@@ -8,8 +8,17 @@ window.tmp$ = null; |
|
|
var $ = require('jquery'),
|
|
|
Swiper = require("yoho-idangerous.swiper");
|
|
|
require("lazyload");
|
|
|
|
|
|
$(".lazy").lazyload();
|
|
|
|
|
|
//菜单初始化所使用变量
|
|
|
|
|
|
var menuTmpl = $("#menuItemTmpl").html(),
|
|
|
dataKey = null,
|
|
|
mustache = require("mustache"),
|
|
|
menuTmplVideo = $("#menuItemTmplVideo").html();
|
|
|
|
|
|
|
|
|
$.fn.top = function() {
|
|
|
if (arguments.length > 0) {
|
|
|
$(this).css("top", arguments[0]);
|
...
|
...
|
@@ -28,8 +37,6 @@ $.fn.left = function() { |
|
|
}
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
$(".lazy").lazyload();
|
|
|
|
|
|
//扩展jquery=================================================================
|
...
|
...
|
@@ -130,16 +137,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 +147,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) {
|
...
|
...
|
@@ -282,13 +276,13 @@ function getBrowType() { |
|
|
var info = {};
|
|
|
var sUserAgent = navigator.userAgent.toLowerCase();
|
|
|
info.bIsIpad = sUserAgent.match(/ipad/i) == "ipad";
|
|
|
// info.bIsIphoneOs = sUserAgent.match(/iphone os/i) == "iphone os";
|
|
|
// info.bIsMidp = sUserAgent.match(/midp/i) == "midp";
|
|
|
// info.bIsUc7 = sUserAgent.match(/rv:1.2.3.4/i) == "rv:1.2.3.4";
|
|
|
// info.bIsUc = sUserAgent.match(/ucweb/i) == "ucweb";
|
|
|
// info.bIsAndroid = sUserAgent.match(/android/i) == "android";
|
|
|
// info.bIsCE = sUserAgent.match(/windows ce/i) == "windows ce";
|
|
|
// info.bIsWM = sUserAgent.match(/windows mobile/i) == "windows mobile";
|
|
|
// info.bIsIphoneOs = sUserAgent.match(/iphone os/i) == "iphone os";
|
|
|
// info.bIsMidp = sUserAgent.match(/midp/i) == "midp";
|
|
|
// info.bIsUc7 = sUserAgent.match(/rv:1.2.3.4/i) == "rv:1.2.3.4";
|
|
|
// info.bIsUc = sUserAgent.match(/ucweb/i) == "ucweb";
|
|
|
// info.bIsAndroid = sUserAgent.match(/android/i) == "android";
|
|
|
// info.bIsCE = sUserAgent.match(/windows ce/i) == "windows ce";
|
|
|
// info.bIsWM = sUserAgent.match(/windows mobile/i) == "windows mobile";
|
|
|
return info;
|
|
|
}
|
|
|
|
...
|
...
|
@@ -301,7 +295,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 +306,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 +336,7 @@ $(document.body).click(function() { |
|
|
if (clientWidth <= 768) {
|
|
|
target.parent().removeAttr("style");
|
|
|
target.css({
|
|
|
width: "auto"
|
|
|
width: "65px"
|
|
|
});
|
|
|
} else {
|
|
|
target.animate({
|
...
|
...
|
@@ -369,26 +351,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 +386,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,4 +394,33 @@ window.scrollWindow = function() { |
|
|
} else if (document.body.clientWidth <= 768) {
|
|
|
window.tmp$(window).scrollTop(600);
|
|
|
}
|
|
|
}; |
|
|
\ No newline at end of file |
|
|
};
|
|
|
|
|
|
//初始化菜单============================================================================
|
|
|
|
|
|
$.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){
|
|
|
if(dataKey!="video"){
|
|
|
mustacheHtml=mustache.render(menuTmpl,data);
|
|
|
_html=$(".submenu-"+dataKey).html();
|
|
|
$(".submenu-"+dataKey).html(mustacheHtml+_html);
|
|
|
}
|
|
|
else{
|
|
|
mustacheHtml=mustache.render(menuTmplVideo,data);
|
|
|
$(".submenu-video").find(".right-content").html(mustacheHtml);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
});
|
|
|
//==================================================================================== |
|
|
\ No newline at end of file |
...
|
...
|
|