Showing
2 changed files
with
12 additions
and
11 deletions
@@ -1719,7 +1719,7 @@ function stopPropagation(e){ | @@ -1719,7 +1719,7 @@ function stopPropagation(e){ | ||
1719 | e.cancelBubble = false; | 1719 | e.cancelBubble = false; |
1720 | } | 1720 | } |
1721 | 1721 | ||
1722 | -function innerScroll(e){ | 1722 | +/**function innerScroll(e){ |
1723 | // 阻止冒泡到document | 1723 | // 阻止冒泡到document |
1724 | // document上已经preventDefault | 1724 | // document上已经preventDefault |
1725 | stopPropagation(e); | 1725 | stopPropagation(e); |
@@ -1741,7 +1741,7 @@ function innerScroll(e){ | @@ -1741,7 +1741,7 @@ function innerScroll(e){ | ||
1741 | } | 1741 | } |
1742 | // 会阻止原生滚动 | 1742 | // 会阻止原生滚动 |
1743 | // return false; | 1743 | // return false; |
1744 | -} | 1744 | +}**/ |
1745 | 1745 | ||
1746 | var disableScroll = function(){ | 1746 | var disableScroll = function(){ |
1747 | $(document).on('mousewheel', preventDefault); | 1747 | $(document).on('mousewheel', preventDefault); |
@@ -1760,8 +1760,9 @@ var enableScroll = function(){ | @@ -1760,8 +1760,9 @@ var enableScroll = function(){ | ||
1760 | enableScroll(); | 1760 | enableScroll(); |
1761 | });**/ | 1761 | });**/ |
1762 | 1762 | ||
1763 | -// 内部可滚 | ||
1764 | -$sideNav.on('mousewheel', innerScroll); | 1763 | + // 内部可滚 |
1764 | +$sideNav.on('touchmove mousewheel', stopPropagation); | ||
1765 | + | ||
1765 | // 外部禁用 | 1766 | // 外部禁用 |
1766 | disableScroll(); | 1767 | disableScroll(); |
1767 | 1768 | ||
@@ -1774,7 +1775,7 @@ $sideNav.on('touchstart', function(e){ | @@ -1774,7 +1775,7 @@ $sideNav.on('touchstart', function(e){ | ||
1774 | }); | 1775 | }); |
1775 | 1776 | ||
1776 | // 仿innerScroll方法 | 1777 | // 仿innerScroll方法 |
1777 | -$sideNav.on('touchmove', function(e){ | 1778 | +/**$sideNav.on('touchmove', function(e){ |
1778 | e.stopPropagation(); | 1779 | e.stopPropagation(); |
1779 | 1780 | ||
1780 | var deltaX = e.originalEvent.touches[0].pageX - startX; | 1781 | var deltaX = e.originalEvent.touches[0].pageX - startX; |
@@ -1802,7 +1803,7 @@ $sideNav.on('touchmove', function(e){ | @@ -1802,7 +1803,7 @@ $sideNav.on('touchmove', function(e){ | ||
1802 | } | 1803 | } |
1803 | // 会阻止原生滚动 | 1804 | // 会阻止原生滚动 |
1804 | // return false; | 1805 | // return false; |
1805 | -}); | 1806 | +});**/ |
1806 | 1807 | ||
1807 | $('.nav-btn').on('touchstart', function(event) { | 1808 | $('.nav-btn').on('touchstart', function(event) { |
1808 | $sideNav.css('pointer-events', 'none'); | 1809 | $sideNav.css('pointer-events', 'none'); |
@@ -1814,10 +1815,10 @@ $('.nav-btn').on('touchstart', function(event) { | @@ -1814,10 +1815,10 @@ $('.nav-btn').on('touchstart', function(event) { | ||
1814 | openSideNav = true; | 1815 | openSideNav = true; |
1815 | 1816 | ||
1816 | //设置boy高宽,页面不能上下滑动 | 1817 | //设置boy高宽,页面不能上下滑动 |
1817 | - $('body').css({ | 1818 | + /**$('body').css({ |
1818 | height: $(window).height(), | 1819 | height: $(window).height(), |
1819 | overflow: 'hidden' | 1820 | overflow: 'hidden' |
1820 | - }); | 1821 | + });**/ |
1821 | 1822 | ||
1822 | setTimeout(function() { | 1823 | setTimeout(function() { |
1823 | $sideNav.css('pointer-events', 'auto'); | 1824 | $sideNav.css('pointer-events', 'auto'); |
@@ -1833,10 +1834,10 @@ function hideSideBar() { | @@ -1833,10 +1834,10 @@ function hideSideBar() { | ||
1833 | $('.overlay').hide(); | 1834 | $('.overlay').hide(); |
1834 | $('.sub-nav').removeClass('show'); | 1835 | $('.sub-nav').removeClass('show'); |
1835 | $sideNav.removeClass('on'); | 1836 | $sideNav.removeClass('on'); |
1836 | - $('body').css({ | 1837 | + /**$('body').css({ |
1837 | height: 'auto', | 1838 | height: 'auto', |
1838 | overflow: 'auto' | 1839 | overflow: 'auto' |
1839 | - }); | 1840 | + });**/ |
1840 | enableScroll(); | 1841 | enableScroll(); |
1841 | } | 1842 | } |
1842 | } | 1843 | } |
@@ -1861,7 +1862,7 @@ $sideNav.on('touchend', 'li', function(e) { | @@ -1861,7 +1862,7 @@ $sideNav.on('touchend', 'li', function(e) { | ||
1861 | 1862 | ||
1862 | //返回一级导航,收起二级导航 | 1863 | //返回一级导航,收起二级导航 |
1863 | $subNav.each(function() { | 1864 | $subNav.each(function() { |
1864 | - $(this).find('li').eq(0).on('touchstart', function() { | 1865 | + $(this).find('li').eq(0).on('touchend', function() { |
1865 | $('.sub-nav').removeClass('show'); | 1866 | $('.sub-nav').removeClass('show'); |
1866 | return false; | 1867 | return false; |
1867 | }); | 1868 | }); |
This diff could not be displayed because it is too large.
-
Please register or login to post a comment