京东6.18大促主会场领京享红包更优惠

 找回密码
 立即注册

QQ登录

只需一步,快速开始

AmazeUI 平滑滚动效果的示例代码

2024-11-2 22:16| 发布者: 76a9| 查看: 99| 评论: 0

摘要: 具体代码如下所示: [code] <!doctype html> <html class="no-js"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="description"

具体代码如下所示:

[code] <!doctype html> <html class="no-js"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="description" content=""> <meta name="keywords" content=""> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>平滑滚动</title> <!--[if (gte IE 9)|!(IE)]><!--> <script src="assets/js/jquery.min.js"></script> <!--<![endif]--> <!--[if lte IE 8 ]> <script src="assets/ie8/jquery.min.js"></script> <script src="assets/ie8/modernizr.js"></script> <script src="assets/js/amazeui.ie8polyfill.min.js"></script> <![endif]--> <script src="assets/js/amazeui.min.js"></script> <link rel="stylesheet" href="assets/css/amazeui.min.css"> </head> <body style="margin:300px;"> <!-- $('html, body').animate({scrollTop: 0}, '500'); //兼容旧版IE的写法 --> <div style="height: 2000px;"></div> <!-- 滚动到顶部 --> <button data-am-smooth-scroll class="am-btn am-btn-success">滚动到顶部</button> <!-- 滚动到底部 --> <button id="doc-scroll-to-btm" class="am-btn am-btn-primary">滚动到底部</button> <script> $('#doc-scroll-to-btm').on('click', function() { var $w = $(window); $w.smoothScroll({position: $(document).height() - $w.height()}); }); </script> <!-- 界说选项 --> <button data-am-smooth-scroll="{position: 57, speed: 5000}" class="am-btn am-btn-danger">慢悠悠地滚到间隔顶部 57px 的位置</button> <!--通过 Data API--> <!-- 在元素上添加 data-am-smooth-scroll 属性。 --> <button data-am-smooth-scroll class="am-btn am-btn-success">滚动到顶部</button> <!-- 假如要指定滚动的位置,可以给这个属性设一个值。 --> <button data-am-smooth-scroll="{position: 189}" class="am-btn am-btn-secondary">指定滚动的位置</button> <!-- 通过 Javascript $(window).smoothScroll([options]); // 滚动到底部 $('#my-button').on('click', function() { var $w = $(window); $w.smoothScroll({position: $(document).height() - $w.height()}); }); --> <div style="height: 2000px;"></div> </body> </html>[/code]

效果图:


 

到此这篇关于AmazeUI 平滑滚动效果的示例代码的文章就介绍到这了,更多相关AmazeUI 平滑滚动内容请搜刮脚本之家以前的文章或继续浏览下面的相关文章,盼望大家以后多多支持脚本之家!


来源:https://www.jb51.net/html5/741606.html
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!
关闭

站长推荐上一条 /6 下一条

QQ|手机版|小黑屋|梦想之都-俊月星空 ( 粤ICP备18056059号 )|网站地图

GMT+8, 2025-7-2 02:42 , Processed in 0.030947 second(s), 18 queries .

Powered by Mxzdjyxk! X3.5

© 2001-2025 Discuz! Team.

返回顶部