// javascript document //全局js function stopbubble(e) { // 如果传入了事件对象,那么就是非ie浏览器 if (e && e.stoppropagation) { //因此它支持w3c的stoppropagation()方法 e.stoppropagation(); } else { //否则我们使用ie的方法来取消事件冒泡 window.event.cancelbubble = true; } } var tap = 'ontouchstart' in document ? 'touchstart' : 'click'; //实现滚动条无法滚动 var mo=function(e){e.preventdefault();}; /***禁止滑动***/ function scrollstop(){ var h = $(window).height(); document.body.style.overflow = 'hidden'; document.addeventlistener("touchmove",mo,false);//禁止页面滑动 } /***取消滑动限制***/ function scrollmove(){ document.body.style.overflow = ''; //出现滚动条 document.removeeventlistener("touchmove",mo,false); } jquery(".foot-support").slide({ maincell: ".foot-jszc", effect: "toploop", autoplay: true, mouseoverstop: false, intertime: 3000 }); $(function() { //start $('#header .nav .e').hover(function() { $(this).find('.hide').stop().slidedown(300); }, function(){ $(this).find('.hide').stop().slideup(300); }); $('.cnav .close').click(function() { $('.cnav').fadeout(300); }) $('.cnav .top').click(function() { $("html,body").stop().animate({ scrolltop: 0 }, 500); }); $('.f1 .links .a2').hover(function() { $('.f1 .links .hide2').stop().fadetoggle(300); }); $("#header-ph .nav").click(function() { if($("body").hasclass("on")){ $("body").removeclass("on"), $("#header-ph .nav").removeclass("on"), $(".pop-nav-box").slideup(350) }else{ $("body").addclass("on"), $("#header-ph .nav").addclass("on"), $(".pop-nav-box").slidedown(350) } }); $(".pop-nav-list .menu-level1 .arrow").click(function() { var n = $(this).parents("li"); n.toggleclass("active").find(".pop-subnav-list").slidetoggle(300).end().siblings("li").removeclass("active").find(".pop-subnav-list").slideup(300) }); $(".inner-navswh .ntit").click(function() { $(".inner-navswh .nlist").stop(true, true).slidetoggle(300); }); $(".inner-navswh .nlist .item").click(function() { var ww=$(document.body).width(); if(ww<991){ $(".inner-navswh .nlist").stop(true, true).slideup(100); } }); function popoverfun(obj, fn){ var ww = $(window).width(); var $obj = $(obj), $zhe = $obj.find('.pop-zhe'), $inner = $obj.find('.pop-inner'), popfn = fn; $obj.fadein(200, function() { $zhe.show(); if($inner.length > 0){ $inner.fadein(200, function() { $obj.addclass('open'); if (popfn != null) popfn(); }); }else{ $obj.addclass('open'); if (popfn != null) popfn(); } }) } $('.pop-close, .pop-zhe').on(tap, function(){ var $obj = $(this).parents('.pop-box'); $obj.removeclass('has-open').fadeout(300); }); $('#imgpop').click(function(){ var ww = $(window).width(); if(ww < 768){ popoverfun('.pop-tvspot-map', function(){ /// 景点地图缩放 var imgwidth = parseint($('#spotmapimg').width()), imgheight = parseint($('#spotmapimg').height()), boxwidth = parseint($(window).outerwidth()), boxheight = parseint($(window).outerheight()); $('#spotmapimg').smartzoom({ maxscale: 2, 'containerclass':'zoomablecontainer', initcallback: function(){ if(imgwidth > imgheight){ var scale = boxheight / imgheight; var x = (imgwidth * scale - boxwidth) /2; $('#spotmapimg').css({'transform': 'scale3d('+ scale +','+ scale +',1) translate3d(-'+ x +'px, 0px, 0px)'}); }else{ var scale = boxwidth / imgwidth; var y = (imgheight * scale - boxheight) /2; $('#spotmapimg').css({'transform': 'scale3d('+ scale +','+ scale +',1) translate3d(0px, -'+ y +'px, 0px)'}); } } }); }); } }) });