/*================== * @authors adrian * @date 2015-08-07 12:40:20 * @version sanxiang core javascript ===================*/ (function($){ var w = window; function getclient(){ w.width = $(w).width(); w.height = $(w).height(); } function bindevents(){ //if(w.width <= 920){ // $('.nav-out > li').off('mouseenter mouseleave').data("bindedevent",false); // if(!$('.nav-out > li').data("bindedevent")){ // $('.nav-out').hide(); // $('.nav-toggle-btn').bind('click',function(){ // $('.nav-out').stop(false,true).slidetoggle(); // }) // $('.nav-out > li').bind('click',function(){ // $(this).children('ul.nav-inner').stop(false,true).slidetoggle(); // $(this).siblings().children('ul.nav-inner').stop(false,true).slideup(); // }) // } //}else{ // $('.nav-out').show(); // $('.nav-out > li').hover(function(){ // $(this).addclass('active').children('ul').stop(false,true).slidedown(300) // },function(){ // $(this).removeclass('active').children('ul').stop(false,true).hide(); // }) //} } function bindsearch(){ if(w.width > 920){ // $('.search-ipt').focus(function(){ // $('.layer-transparent').css('height',document.body.clientheight+'px'); // $('.layer-transparent').show(); // $('.search-layer').addclass('active'); // }) // $('.layer-transparent').bind('click',function(){ // $('.layer-transparent').hide(); // }) $('.search-ipt').focus(function(){ $(this).css({ "z-index":"1", "padding-left":"40px", "border":"1px solid #e8e8e8" }).stop(true,false).animate({ "width":"120px" },"fast") }).blur(function(){ $(this).css({ "z-index":"3", "padding-left":"0px", "border":"none" }).stop(true,false).animate({ "width":"40px" },"fast"); $(this).val(''); }) } } function togglewebsites(){ $('.link-websites,.layer-transparent').bind('click',function(){ $('.layer-transparent').toggle(); if($('html').hasclass('webs-opend')){ $('html').toggleclass('webs-opend'); settimeout("$('.websites-wrap').hide();",500); }else{ $('.websites-wrap').show(); $('.websites-wrap').css('height',$(document).height()+'px'); $('html').toggleclass('webs-opend'); } }) } // main function $(function(){ getclient(); bindevents(); bindsearch(); togglewebsites(); $(w).resize(function(event) { getclient(); bindevents(); bindsearch(); togglewebsites() }); $('.slidesjs-navigation').hide(); $('.crs-wrap').hover(function(){ $('.slidesjs-navigation').fadein(); },function(){ $('.slidesjs-navigation').fadeout(); }) var news_timer; var $news_ul = $(".col-news-scroll-wrap > ul"); n_l_timer = setinterval(news_slide,5000); function news_slide(){ $news_ul.animate({"top":-50 + "px"},1500,function(){ $news_ul.css("top","0").find("li:first").appendto($news_ul); }) } $(".news-wrapper").hover(function(){ clearinterval(news_timer); },function(){ news_timer = setinterval(news_slide,5000); }); $('.col-link a').hover(function(){ $(this).addclass('active').siblings().addclass('n-active'); },function(){ $(this).removeclass('active').siblings().removeclass('n-active'); }) $('.websites-wrap').hide(); }) })(jquery) $(function(){ $(window).scroll(function(){ if ($(window).scrolltop()>100){ $(".backtop").fadein(800); } else { $(".backtop").fadeout(800); } }) $(".backtop").click(function(){ $('body,html').animate({scrolltop:0},1000); return false; }) })