-
Notifications
You must be signed in to change notification settings - Fork 458
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 修复sidebar弹出后,背景主体可以滚动的bug * 支持body不滚动,状态复原 * 支持body不滚动,状态复原
- Loading branch information
1 parent
6915ea2
commit 9fd8d32
Showing
3 changed files
with
21 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
/** | ||
* @file 侧边栏组件 | ||
* | ||
* @author [email protected] | ||
* @author [email protected], liangjiaying | ||
* @version 1.0 | ||
* @copyright 2016 Baidu.com, Inc. All Rights Reserved | ||
*/ | ||
|
@@ -29,11 +29,13 @@ define(function (require) { | |
return; | ||
} | ||
|
||
// pageScroll_.call(self); | ||
|
||
util.css(self.element, {display: 'block'}); | ||
openMask.call(self); | ||
|
||
|
||
self.bodyOverflow = getComputedStyle(document.body).overflow; | ||
document.body.style.overflow = "hidden"; | ||
|
||
// 动画效果 | ||
var openTimer = setTimeout(function () { | ||
|
||
|
@@ -60,6 +62,8 @@ define(function (require) { | |
|
||
closeMask.call(self); | ||
|
||
document.body.style.overflow = self.bodyOverflow; | ||
|
||
// 动画效果 | ||
var closeTimer = setTimeout(function () { | ||
|
||
|
@@ -96,11 +100,7 @@ define(function (require) { | |
} | ||
|
||
self.maskElement.setAttribute('on', 'tap:' + self.id + '.close'); | ||
//侧边栏调出来后页面主体部分禁止滚动 | ||
self.maskElement.addEventListener('touchmove', function(e) { | ||
e.preventDefault(); | ||
e.stopPropagation(); | ||
},false); | ||
|
||
// 样式设置 | ||
util.css(self.maskElement, {display: 'block'}); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,16 @@ | ||
{ | ||
"name": "mip-sidebar", | ||
"version": "1.1.4", | ||
"author": { | ||
"name": "wangpei07", | ||
"email": "[email protected]", | ||
"url": "https://www.mipengine.org" | ||
}, | ||
"version": "1.1.5", | ||
"contributers": [ | ||
{ | ||
"name": "wangpei07", | ||
"email": "[email protected]", | ||
"url": "https://www.mipengine.org" | ||
},{ | ||
"name": "Jenny_L", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"engines": { | ||
"mip": ">=1.1.0" | ||
} | ||
|
9fd8d32
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
请问这个bug修复以后,用法和原来没有区别吗?我的网页上,侧边栏弹出后,主体页面仍然会滚动。