Skip to content

Commit

Permalink
调整页面过度及延迟时间
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaogliu committed May 5, 2018
1 parent 6c73b10 commit 5476919
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 20 deletions.
4 changes: 2 additions & 2 deletions demo/es6_module/js/components/pureFullPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default class PureFullPage {
// 默认配置
const defaultOptions = {
isShowNav: true,
delay: 900,
delay: 1200,
definePages: () => {},
};
utils.polyfill();
Expand Down Expand Up @@ -171,4 +171,4 @@ export default class PureFullPage {
// 窗口尺寸变化时重置位置
window.addEventListener('resize', this.handleWindowResize.bind(this));
}
}
}
4 changes: 2 additions & 2 deletions demo/es6_module/js/components/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export default {
// 截流函数,method 回调函数,context 上下文,delay 延迟函数,
throttle(method, context, delay) {
let wait = false;
return function() {
return function () {
if (!wait) {
method.apply(context, arguments);
wait = true;
Expand Down Expand Up @@ -68,4 +68,4 @@ export default {
});
}
},
};
};
2 changes: 1 addition & 1 deletion dist/pureFullPage.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/pureFullPage.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,15 @@ new PureFullPage().init();
```js
// 创建实例并初始化
new PureFullPage({
delay: 900,
delay: 1200,
isShowNav: true,
definePages: addAnimation,
}).init();
```

其中:

* `delay` 截流/间隔函数延迟时间,默认 900 ms,为了兼容 Mac 触控板,这个值最好大于 900ms
* `delay` 截流/间隔函数延迟时间,默认 1200 ms,为了兼容 Mac 触控板,这个值最好大于 1000ms

* `isShowNav` 控制是否显示右侧导航,Boolean 类型,默认为 `true`,设为 `false` 则不显示;

Expand Down
12 changes: 4 additions & 8 deletions src/css/pureFullPage.scss
Original file line number Diff line number Diff line change
@@ -1,27 +1,25 @@
html,
body {
padding: 0;
margin: 0;
// 此处 body 作为全屏滚动的父级容器
margin: 0; // 此处 body 作为全屏滚动的父级容器
overflow: hidden;
}

/* pure full page 样式 */

#pureFullPage {
position: relative;
top: 0;
transition: all 500ms;
transition: all 1100ms ease;
.page {
width: 100%;
height: 100%;
&:nth-child(1) {
background: lightpink no-repeat center/cover;
}

&:nth-child(2) {
background: lightgreen no-repeat center/cover;
}

&:nth-child(3) {
background: lightskyblue no-repeat center/cover;
}
Expand Down Expand Up @@ -50,18 +48,16 @@ body {
border-radius: 12px;
transition: all 150ms ease-in-out;
}

&:hover span {
width: 8px;
height: 16px;
background-color: #fff;
}

&.active span {
width: 10px;
height: 20px;
background-color: #fff;
}
}
}
}
}
4 changes: 2 additions & 2 deletions src/js/pureFullPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class PureFullPage {
// 默认配置
const defaultOptions = {
isShowNav: true,
delay: 900,
delay: 1200,
definePages: () => {},
};
utils.polyfill();
Expand Down Expand Up @@ -172,4 +172,4 @@ class PureFullPage {
// 窗口尺寸变化时重置位置
window.addEventListener('resize', this.handleWindowResize.bind(this));
}
}
}
4 changes: 2 additions & 2 deletions src/js/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const utils = {
// 截流函数,method 回调函数,context 上下文,delay 延迟函数,
throttle(method, context, delay) {
let wait = false;
return function() {
return function () {
if (!wait) {
method.apply(context, arguments);
wait = true;
Expand Down Expand Up @@ -68,4 +68,4 @@ const utils = {
});
}
},
};
};

0 comments on commit 5476919

Please sign in to comment.