...
|
...
|
@@ -3,320 +3,273 @@ |
|
|
* @author:Hbomb(zhouqq@yoho.cn)
|
|
|
* @date:2013-05-7
|
|
|
*/
|
|
|
window.tmp$=null;
|
|
|
var $ = require('jquery');
|
|
|
window.tmp$=$;
|
|
|
var Swiper=require("yoho.swiper");
|
|
|
require('./plugin/lazyloadImage');
|
|
|
$(".lazy").lazyload();
|
|
|
$.fn.top=function(){
|
|
|
if(arguments.length>0)
|
|
|
{
|
|
|
$(this).css("top",arguments[0]);
|
|
|
return $(this);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
return parseFloat($(this).css("top").replace("px",""));
|
|
|
}
|
|
|
|
|
|
};
|
|
|
$.fn.left=function(){
|
|
|
if(arguments.length>0)
|
|
|
{
|
|
|
$(this).css("left",arguments[0]);
|
|
|
return $(this);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
return parseFloat($(this).css("left").replace("px",""));
|
|
|
}
|
|
|
};
|
|
|
$.fn.id=function(){
|
|
|
if(arguments.length>0)
|
|
|
{
|
|
|
$(this).attr("id",arguments[0]);
|
|
|
return $(this);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
return $(this).attr("id");
|
|
|
}
|
|
|
};
|
|
|
|
|
|
//banner========================================================================================================
|
|
|
if($(".swiper-container").find(".swiper-slide").length>1)
|
|
|
{
|
|
|
var mySwiper = new Swiper('.swiper-container',{
|
|
|
pagination: '.pagination-banner',
|
|
|
loop:true,
|
|
|
autoplay:5000,
|
|
|
grabCursor: true,
|
|
|
paginationClickable: true,
|
|
|
autoStopPlay:false
|
|
|
});
|
|
|
$('.arrow-left').on('click', function(e){
|
|
|
e.preventDefault();
|
|
|
mySwiper.swipePrev();
|
|
|
});
|
|
|
$('.arrow-right').on('click', function(e){
|
|
|
e.preventDefault();
|
|
|
mySwiper.swipeNext();
|
|
|
});
|
|
|
}
|
|
|
|
|
|
//==============================================================================================================
|
|
|
window.tmp$ = null;
|
|
|
var $ = require('jquery');
|
|
|
window.tmp$ = $;
|
|
|
require("lazyload");
|
|
|
var Swiper = require("yoho-idangerous.swiper");
|
|
|
$(".lazy").lazyload();
|
|
|
|
|
|
$(".getapp").hover(function(){$(this).find(".bitmap").show();$("img").lazyload();},function(){$(this).find(".bitmap").hide()});
|
|
|
$(".li-weixin").hover(function(){$(this).find(".pop").show();$(this).find(".pop").find("img").show();$("img").lazyload();},function(){$(this).find(".pop").hide()});
|
|
|
$(".getapp").mouseover(function(){return false;});
|
|
|
$(".li-weixin").mouseover(function(){return false;});
|
|
|
$(".li-weixin").click(function(){
|
|
|
return false;
|
|
|
});
|
|
|
$("#maxEnterprise").click(function(){$(".bitmap").hide();$(".pop").hide();});
|
|
|
$("#minEnterprise").click(function(){$(".bitmap").hide();$(".pop").hide();});
|
|
|
$(".content").click(function(){$(".bitmap").hide();$(".pop").hide();});
|
|
|
//企业滚动效果======================================================================================================
|
|
|
var minMenuHasShow=false;//小导航是否显示
|
|
|
var isTop=true;//滚动条是否在顶部
|
|
|
$(window).scroll(function(){
|
|
|
var scrollTop=$(this).scrollTop();
|
|
|
if(scrollTop>=177&&minMenuHasShow===false)
|
|
|
{
|
|
|
$(".search-input-box").trigger("blur");
|
|
|
$("#maxEnterprise").css({visibility:"hidden"});
|
|
|
$("#minEnterprise").css({"position":"fixed",
|
|
|
"margin-top":"0",
|
|
|
"padding-top":"10px",
|
|
|
"top":0,
|
|
|
//left:"50%",
|
|
|
"z-index":99999
|
|
|
}).show();
|
|
|
minMenuHasShow=true;
|
|
|
$(".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;
|
|
|
}
|
|
|
else if(scrollTop<177&&minMenuHasShow===true)
|
|
|
{
|
|
|
$(".search-input-box").trigger("blur");
|
|
|
$("#maxEnterprise").css({visibility:"visible"});
|
|
|
$("#minEnterprise").hide();
|
|
|
$(".search-input-box").hide();
|
|
|
$(".home-search-button").hide();
|
|
|
window.isSearching=false;
|
|
|
minMenuHasShow=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;
|
|
|
}
|
|
|
|
|
|
if(scrollTop>0&&isTop===true)
|
|
|
{
|
|
|
$(".return-to-top").stop().animate({"filter":"alpha(opacity=70)","-moz-opacity":"0.7",opacity:"0.7"},200);
|
|
|
isTop=false;
|
|
|
}
|
|
|
else if(scrollTop==0){
|
|
|
$(".return-to-top").stop().animate({"filter":"alpha(opacity=0)","-moz-opacity":"0",opacity:"0"},200);
|
|
|
isTop=true;
|
|
|
}
|
|
|
$(".search-suggest").hide();
|
|
|
});
|
|
|
|
|
|
//===============================================================================================================
|
|
|
if(document.body.scrollTop>0&&isTop===true)
|
|
|
{
|
|
|
$(".return-to-top").animate({"filter":"alpha(opacity=70)","-moz-opacity":"0.7",opacity:"0.7"},200);
|
|
|
isTop=false;
|
|
|
}
|
|
|
else if(document.body.scrollTop==0){
|
|
|
$(".return-to-top").animate({"filter":"alpha(opacity=0)","-moz-opacity":"0",opacity:"0"},200);
|
|
|
isTop=true;
|
|
|
}
|
|
|
|
|
|
//回到顶部按钮======================================================================================================
|
|
|
$(".return-to-top").click(function(){
|
|
|
$("html,body").animate({scrollTop:0},300,function(){
|
|
|
$(".return-to-top").animate({"filter":"alpha(opacity=0)","-moz-opacity":"0",opacity:"0"},200);
|
|
|
});
|
|
|
});
|
|
|
//===============================================================================================================
|
|
|
|
|
|
|
|
|
|
|
|
//子菜单交互========================================================================================================
|
|
|
/*$.ajax({
|
|
|
url:"",
|
|
|
cache:false,
|
|
|
success:function(data){
|
|
|
var data=data.data;
|
|
|
}
|
|
|
});*/
|
|
|
function createSubMenu(info){
|
|
|
var data={};
|
|
|
data.menun=info.menu;//大菜单名字
|
|
|
data.submenu=info.submenu;//子菜单名字
|
|
|
}
|
|
|
//================================================================================================================
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//频道页、首页碎片交互=================================================================================================
|
|
|
//mulLine.init();
|
|
|
function dealItems()
|
|
|
{
|
|
|
var citems=$(".content-item,.content-item-without-border");
|
|
|
if (!citems.length)
|
|
|
{
|
|
|
return;
|
|
|
}
|
|
|
//扩展jquery=================================================================
|
|
|
$.fn.id = function() {
|
|
|
if (arguments.length > 0) {
|
|
|
$(this).attr("id", arguments[0]);
|
|
|
return $(this);
|
|
|
} else {
|
|
|
return $(this).attr("id");
|
|
|
}
|
|
|
};
|
|
|
|
|
|
var totalLineNum = 7; // 7 行
|
|
|
var maxTitleStrNum = 45; // 15个字
|
|
|
var maxDetailStrNum = 66; // 22个字
|
|
|
//banner========================================================================================================
|
|
|
if ($(".swiper-container").find(".swiper-slide").length > 1) {
|
|
|
var mySwiper = new Swiper('.swiper-container', {
|
|
|
pagination : '.pagination-banner',
|
|
|
loop : true,
|
|
|
autoplay : 5000,
|
|
|
grabCursor : true,
|
|
|
paginationClickable : true,
|
|
|
autoStopPlay : false
|
|
|
});
|
|
|
$('.arrow-left').on('click', function(e) {
|
|
|
e.preventDefault();
|
|
|
mySwiper.swipePrev();
|
|
|
});
|
|
|
$('.arrow-right').on('click', function(e) {
|
|
|
e.preventDefault();
|
|
|
mySwiper.swipeNext();
|
|
|
});
|
|
|
}
|
|
|
|
|
|
if (document.body.clientWidth<1190)
|
|
|
{
|
|
|
totalLineNum = 6; // 6 行
|
|
|
maxTitleStrNum = 39; // 13个字
|
|
|
maxDetailStrNum = 54; // 18个字
|
|
|
}
|
|
|
//==============================================================================================================
|
|
|
|
|
|
var titleLineNum = 0;
|
|
|
var subTitleLineNum = 0;
|
|
|
var detailLineNum = 0;
|
|
|
var detailStr = "";
|
|
|
var self = null;
|
|
|
|
|
|
citems.each(function()
|
|
|
{
|
|
|
self=$(this);
|
|
|
//centerbanner=============================================================================
|
|
|
var bannerSwiper = new Swiper('.swiper-container2', {
|
|
|
pagination : '.pagination-adv',
|
|
|
loop : true,
|
|
|
autoplay : 2000,
|
|
|
autoStopPlay : false,
|
|
|
paginationClickable : true,
|
|
|
onSlideChangeEnd : function() {
|
|
|
bannerSwiper.startAutoplay();
|
|
|
$(".swiper-container2 .lazy").lazyload();
|
|
|
}
|
|
|
});
|
|
|
//================================================================================================
|
|
|
|
|
|
// 主标题行数
|
|
|
titleLineNum = 1;
|
|
|
if ( maxTitleStrNum < parseInt(self.find(".a-title").attr('len'), 10) )
|
|
|
{
|
|
|
titleLineNum = 2;
|
|
|
}
|
|
|
$(".getapp").hover(function() {
|
|
|
$(this).find(".bitmap").show();
|
|
|
$("img").lazyload();
|
|
|
}, function() {
|
|
|
$(this).find(".bitmap").hide()
|
|
|
});
|
|
|
$(".li-weixin").hover(function() {
|
|
|
$(this).find(".pop").show();
|
|
|
$(this).find(".pop").find("img").show();
|
|
|
$("img").lazyload();
|
|
|
}, function() {
|
|
|
$(this).find(".pop").hide()
|
|
|
});
|
|
|
$(".getapp").mouseover(function() {
|
|
|
return false;
|
|
|
});
|
|
|
$(".li-weixin").mouseover(function() {
|
|
|
return false;
|
|
|
});
|
|
|
$(".li-weixin").click(function() {
|
|
|
return false;
|
|
|
});
|
|
|
$(".content").click(function() {
|
|
|
$(".bitmap").hide();
|
|
|
$(".pop").hide();
|
|
|
});
|
|
|
|
|
|
// 副标题行数
|
|
|
subTitleLineNum = 1;
|
|
|
if ( maxTitleStrNum < parseInt(self.find(".a-subtitle").attr('len'), 10) )
|
|
|
{
|
|
|
subTitleLineNum = 2;
|
|
|
}
|
|
|
//回到顶部按钮======================================================================================================
|
|
|
$(".return-to-top").click(function() {
|
|
|
$("html,body").animate({
|
|
|
scrollTop : 0
|
|
|
}, 300, function() {
|
|
|
$(".return-to-top").animate({
|
|
|
"filter" : "alpha(opacity=0)",
|
|
|
"-moz-opacity" : "0",
|
|
|
opacity : "0"
|
|
|
}, 200);
|
|
|
});
|
|
|
});
|
|
|
//===============================================================================================================
|
|
|
|
|
|
// 摘要内容行数
|
|
|
detailLineNum = totalLineNum - titleLineNum - subTitleLineNum;
|
|
|
if ( (maxDetailStrNum * detailLineNum) < parseInt(self.find(".a-detail").attr('len'), 10) )
|
|
|
{
|
|
|
//self.find(".a-detail").mlellipsis(detailLineNum, "detail");
|
|
|
detailStr = self.find(".a-detail").attr("_title").substring(0, maxDetailStrNum * detailLineNum / 3) + " ...";
|
|
|
self.find(".a-detail").text( detailStr.replace(/[a-zA-Z]+?\s{1}\.\.\.\B/, " ...") );
|
|
|
}
|
|
|
});
|
|
|
citems = null;
|
|
|
}
|
|
|
|
|
|
// function fillDetail()
|
|
|
// {
|
|
|
// var citems=$(".content-item");
|
|
|
// if(citems.length>0)
|
|
|
// {
|
|
|
// citems.each(function(index,obj){
|
|
|
// var self=$(obj);
|
|
|
// self.find(".a-detail").fillText("detail");
|
|
|
//
|
|
|
// });
|
|
|
// }
|
|
|
// }
|
|
|
|
|
|
$(function(){
|
|
|
dealItems();
|
|
|
});
|
|
|
|
|
|
window.currentWidth=document.body.clientWidth;
|
|
|
//================================================================================================================
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//=================================================================================================================
|
|
|
/*$(window).bind("resize",function(){
|
|
|
fillDetail();
|
|
|
});*/
|
|
|
//=================================================================================================================
|
|
|
|
|
|
var isIpad = getBrowType().bIsIpad;
|
|
|
|
|
|
if (isIpad === true) {
|
|
|
$(".search-loading-icon").hide();
|
|
|
$(".search-area").width($(".search-area").width()-43);
|
|
|
$(".search-icon").show();
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
$(".search-loading-icon").hide();
|
|
|
$(".search-text").show();
|
|
|
}
|
|
|
|
|
|
|
|
|
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";
|
|
|
return info;
|
|
|
//子菜单交互========================================================================================================
|
|
|
function createSubMenu(info) {
|
|
|
var data = {};
|
|
|
data.menun = info.menu;
|
|
|
//大菜单名字
|
|
|
data.submenu = info.submenu;
|
|
|
//子菜单名字
|
|
|
}
|
|
|
|
|
|
//================================================================================================================
|
|
|
|
|
|
//频道页、首页碎片交互=================================================================================================
|
|
|
//mulLine.init();
|
|
|
function dealItems() {
|
|
|
var citems = $(".content-item,.content-item-without-border");
|
|
|
if (!citems.length) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
var totalLineNum = 7;
|
|
|
// 7 行
|
|
|
var maxTitleStrNum = 45;
|
|
|
// 15个字
|
|
|
var maxDetailStrNum = 66;
|
|
|
// 22个字
|
|
|
|
|
|
if (document.body.clientWidth < 1190) {
|
|
|
totalLineNum = 6;
|
|
|
// 6 行
|
|
|
maxTitleStrNum = 39;
|
|
|
// 13个字
|
|
|
maxDetailStrNum = 54;
|
|
|
// 18个字
|
|
|
}
|
|
|
|
|
|
var titleLineNum = 0;
|
|
|
var subTitleLineNum = 0;
|
|
|
var detailLineNum = 0;
|
|
|
var detailStr = "";
|
|
|
var self = null;
|
|
|
|
|
|
citems.each(function() {
|
|
|
self = $(this);
|
|
|
|
|
|
// 主标题行数
|
|
|
titleLineNum = 1;
|
|
|
if (maxTitleStrNum < parseInt(self.find(".a-title").attr('len'), 10)) {
|
|
|
titleLineNum = 2;
|
|
|
}
|
|
|
|
|
|
// 副标题行数
|
|
|
subTitleLineNum = 1;
|
|
|
if (maxTitleStrNum < parseInt(self.find(".a-subtitle").attr('len'), 10)) {
|
|
|
subTitleLineNum = 2;
|
|
|
}
|
|
|
|
|
|
// 摘要内容行数
|
|
|
detailLineNum = totalLineNum - titleLineNum - subTitleLineNum;
|
|
|
if ((maxDetailStrNum * detailLineNum) < parseInt(self.find(".a-detail").attr('len'), 10)) {
|
|
|
//self.find(".a-detail").mlellipsis(detailLineNum, "detail");
|
|
|
detailStr = self.find(".a-detail").attr("_title").substring(0, maxDetailStrNum * detailLineNum / 3) + " ...";
|
|
|
self.find(".a-detail").text(detailStr.replace(/[a-zA-Z]+?\s{1}\.\.\.\B/, " ..."));
|
|
|
}
|
|
|
});
|
|
|
citems = null;
|
|
|
}
|
|
|
|
|
|
//分享按钮位置
|
|
|
if (!isIpad && $(".share").size()>0){
|
|
|
var shareOffsetTop = $(".share").offset().top;
|
|
|
var navHeight = $("#minEnterprise").outerHeight();
|
|
|
$(window).scroll(function(){
|
|
|
scrollTop = $(window).scrollTop();
|
|
|
if(shareOffsetTop-scrollTop-navHeight <= 0){
|
|
|
$(".share").css({"position":"fixed","top":navHeight});
|
|
|
}else{
|
|
|
$(".share").css({"position":"absolute","top":shareOffsetTop});
|
|
|
}
|
|
|
$(function() {
|
|
|
dealItems();
|
|
|
});
|
|
|
|
|
|
window.currentWidth = document.body.clientWidth;
|
|
|
//================================================================================================================
|
|
|
|
|
|
//=================================================================================================================
|
|
|
/*$(window).bind("resize",function(){
|
|
|
fillDetail();
|
|
|
});*/
|
|
|
//=================================================================================================================
|
|
|
|
|
|
var isIpad = getBrowType().bIsIpad;
|
|
|
|
|
|
if (isIpad === true) {
|
|
|
$(".search-loading-icon").hide();
|
|
|
$(".search-area").width($(".search-area").width() - 43);
|
|
|
$(".search-icon").show();
|
|
|
} else {
|
|
|
$(".search-loading-icon").hide();
|
|
|
$(".search-text").show();
|
|
|
}
|
|
|
|
|
|
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";
|
|
|
return info;
|
|
|
}
|
|
|
|
|
|
//分享按钮位置
|
|
|
if (!isIpad && $(".share").size() > 0) {
|
|
|
var shareOffsetTop = $(".share").offset().top;
|
|
|
var navHeight = $("#minEnterprise").outerHeight();
|
|
|
$(window).scroll(function() {
|
|
|
scrollTop = $(window).scrollTop();
|
|
|
if (shareOffsetTop - scrollTop - navHeight <= 0) {
|
|
|
$(".share").css({
|
|
|
"position" : "fixed",
|
|
|
"top" : navHeight
|
|
|
});
|
|
|
} else {
|
|
|
$(".share").css({
|
|
|
"position" : "absolute",
|
|
|
"top" : shareOffsetTop
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
//搜索按钮===========================================================================
|
|
|
$(".search-input-box").keypress(function(event) {
|
|
|
var keyCode = event.keyCode;
|
|
|
if (keyCode === 13) {
|
|
|
$("#search-button").trigger("click");
|
|
|
}
|
|
|
});
|
|
|
|
|
|
$("#search-button").click(function(){
|
|
|
if($.trim($(".search-input-box").val())!==""){
|
|
|
document.location=$(this).attr("searchURL")+"?q="+$(".search-input-box").val();
|
|
|
}
|
|
|
return false;
|
|
|
});
|
|
|
|
|
|
$(document.body).click(function(){
|
|
|
var target = $(".search-text");
|
|
|
target.find(".search-input-box").hide();
|
|
|
target.find(".home-search-button").hide();
|
|
|
target.find(".search-text-content").show();
|
|
|
target.animate({
|
|
|
width : 120
|
|
|
}, 500);
|
|
|
});
|
|
|
$(".search-text").click(function(){return false;});
|
|
|
$(".search-text").click(function() {
|
|
|
$(this).find(".search-text-content").hide();
|
|
|
$(this).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();
|
|
|
});
|
|
|
|
|
|
});
|
|
|
//=================================================================================
|
|
|
|
|
|
window.scrollWindow=function()
|
|
|
{
|
|
|
if(document.body.clientWidth>=1190)
|
|
|
{
|
|
|
//document.body.scrollTop=850;
|
|
|
window.tmp$(window).scrollTop(850);
|
|
|
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 < 1190 && document.body.clientWidth > 768) {
|
|
|
window.tmp$(window).scrollTop(700);
|
|
|
|
|
|
}
|
|
|
else if(document.body.clientWidth<=768)
|
|
|
{
|
|
|
window.tmp$(window).scrollTop(600);
|
|
|
}
|
|
|
}; |
|
|
\ No newline at end of file |
|
|
} else if (document.body.clientWidth <= 768) {
|
|
|
window.tmp$(window).scrollTop(600);
|
|
|
}
|
|
|
}; |
...
|
...
|
|