1
Q
先進的滑塊定製
A
回答
1
(function($) {
var elem = $.jInvertScroll(['.scroll'], // an array containing the selector(s) for the elements you want to animate
{
height: 6000, // optional: define the height the user can scroll, otherwise the overall length will be taken as scrollable height
onScroll: function(percent) { //optional: callback function that will be called when the user scrolls down, useful for animating other things on the page
console.log(percent);
}
});
$(window).resize(function() {
if ($(window).width() <= 768) {
elem.destroy();
}
else {
elem.reinitialize();
}
});
}(jQuery));
html,
body
{
padding: 0;
margin: 0;
font-family: Arial, sans-serif;
}
/* hide horizontal scrollbars, since we use the vertical ones to scroll to the right */
body
{
overflow-x: hidden;
background: url('../images/bg.jpg') repeat top left;
}
h1
{
font-size: 20px;
font-weight: normal;
color: #2e6e80;
}
/**
* important: keep position fixed, you can however use top:0 instead of bottom:0
* if you want to make it stick to the top of the browser
*/
.scroll
{
position: fixed;
bottom: 0;
left: 0;
}
/**
* z-index ordering of the different layers, do this for your layers,
* also assign absolute width (to prevent issues if the script gets executed before the images get loaded)
*/
.horizon
{
z-index: 1;
width: 3000px;
}
.middle
{
z-index: 500;
width: 4000px;
}
.front
{
z-index: 1000;
width: 6000px;
}
<h1>jInvertScroll Example</h1>
<div class="horizon scroll">
<img src="https://raw.githubusercontent.com/pixxelfactory/jInvertScroll/master/examples/images/horizon.png" alt="" />
</div>
<div class="middle scroll">
<img src="https://raw.githubusercontent.com/pixxelfactory/jInvertScroll/master/examples/images/middle.png" alt="" />
</div>
<div class="front scroll">
<img src="https://raw.githubusercontent.com/pixxelfactory/jInvertScroll/master/examples/images/front.png" alt="" />
</div>
<script src="http://www.pixxelfactory.net/jInvertScroll/js/jquery.min.js"></script>
<script src="http://www.pixxelfactory.net/jInvertScroll/js/jquery.jInvertScroll.js"></script>
相關問題
- 1. 控制MediaController進度滑塊
- 2. 定製jQuery UI的滑塊
- 3. 如何定製滑塊?
- 4. 定製nivo滑塊jQuery
- 5. 將滑塊輸入綁定到十進制值的AngularJS問題
- 6. 使用進度條製作滑塊
- 7. 滑塊值,int到二進制轉換
- 8. 如何製作順序步進滑塊?
- 9. 製作Div滑塊
- 10. Jssor滑塊嵌入在WordPress - 定製化
- 11. 定製後滑塊不工作XAML
- 12. 負AngularJS滑塊與定製規模
- 13. 垂直滑塊需要更多定製
- 14. Zurb基金會軌道滑塊定製
- 15. WPF定製滑塊drawed自己
- 16. 有限制的jQuery滑塊
- 17. jQuery滑塊的拖動控制柄/滑塊上的值
- 18. 自定義滑塊
- 19. 在引導佈局定製光滑滑塊
- 20. 滑塊內的滑動滑塊
- 21. 帶滑動滑塊的Jquery滑塊
- 22. CSS需要爲滑塊後面的jquery滑塊製作標籤
- 23. 限制jQuery的滑塊到另一個滑塊
- 24. 混合滑塊控制
- 25. 範圍滑塊控制
- 26. Jquery滑塊控制音量
- 27. 具有十進制支持的jQuery UI滑塊
- 28. 優先滑軌滑行
- 29. 自定義全寬度滑動滑塊
- 30. 滑動滑塊自定義點