// 鼠标滚动导航栏效果 /* var scrollfunc = function (e) { var headerbox = document.getelementbyid('headerbox') e = e || window.event if (e.wheeldelta) { //判断浏览器ie,谷歌滑轮事件 if (e.wheeldelta > 0) { // 滑轮向上滚动 $('#headerbox').slidedown() //headerbox.style.display = 'block' } if (e.wheeldelta < 0) { // 滑轮向下滚动 $('#headerbox').slideup() $("#returntop").show() //headerbox.style.display = 'none' } } else if (e.detail) { //firefox滑轮事件 if (e.detail> 0) { // 滑轮向上滚动 $('#headerbox').slideup() //headerbox.style.display = 'block' } if (e.detail< 0) { // 滑轮向下滚动 $('#headerbox').slidedown() $("#returntop").show() //headerbox.style.display = 'none' } } } */ // function titleclick(id,liid) { // id.click(function () { // liid.toggle(); // }) // } // titleclick($("#liabout"),$("#menudownabout")); // titleclick($("#liculture"),$("#menudownculture")); // titleclick($("#liduty"),$("#menudownduty")); // titleclick($("#lidevelop"),$("#menudowndevelop")); // titleclick($("#liabout"),$("#menudownabout")); $(function(){ $("#returntop").click(function () { // var speed = 800;//滑动的速度 // $('body,html').animate({ scrolltop: 0 }, speed); /* $("#returntop").hide() $('#headerbox').slidedown() */ // return false; location.href="https://www.sc.gov.cn/"; }); }) var windowwidth = $(window).width(); if(windowwidth > 500) { //给页面绑定滑轮滚动事件 if (document.addeventlistener) {//firefox //document.addeventlistener('dommousescroll', scrollfunc, false); } //滚动滑轮触发scrollfunc方法 //ie 谷歌 // window.onmousewheel = document.onmousewheel = scrollfunc; }else{ $('.navmenu').on('click', function(){ $('#menulist').toggle() }) //更换导航栏 $(function () { jquery.support.cors=true; $.ajax({ url: 'http://www.sdholding.com/admin/navbar', type: 'get', crossdomain: true , success: function (data) { var navbars = data.navbars var html = '
  • 首页
  • ' for(var i = 0; i < navbars.length; i++){ html += '
  • ' html += ''+navbars[i].name+'' html += '' html += '
  • ' } $('#menulist').html(html) $('#menulist').find('li').on('click', function(){ $(this).find('.menudown').toggle() var index = $(this).index(); $(this).siblings().find(".menudown").css('display','none'); }) } }) $(window).bind('scroll', function() { var len = $(this).scrolltop() if (len >= 20) { $('#menulist').hide(); } }) }) }