溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

前端開發(fā)AmazeUI平滑滾動(dòng)如何實(shí)現(xiàn)

發(fā)布時(shí)間:2022-02-25 10:56:22 來(lái)源:億速云 閱讀:266 作者:iii 欄目:開發(fā)技術(shù)

這篇文章主要介紹“前端開發(fā)AmazeUI平滑滾動(dòng)如何實(shí)現(xiàn)”,在日常操作中,相信很多人在前端開發(fā)AmazeUI平滑滾動(dòng)如何實(shí)現(xiàn)問題上存在疑惑,小編查閱了各式資料,整理出簡(jiǎn)單好用的操作方法,希望對(duì)大家解答”前端開發(fā)AmazeUI平滑滾動(dòng)如何實(shí)現(xiàn)”的疑惑有所幫助!接下來(lái),請(qǐng)跟著小編一起來(lái)學(xué)習(xí)吧!

具體代碼如下所示:

<!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>平滑滾動(dòng)</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 >
<!-- $('html, body').animate({scrollTop: 0}, '500'); //兼容舊版IE的寫法 -->
<div ></div>
<!-- 滾動(dòng)到頂部 -->
<button data-am-smooth-scroll class="am-btn am-btn-success">滾動(dòng)到頂部</button>
<!-- 滾動(dòng)到底部 -->
<button id="doc-scroll-to-btm" class="am-btn am-btn-primary">滾動(dòng)到底部</button>
<script>
  $('#doc-scroll-to-btm').on('click', function() {
    var $w = $(window);
    $w.smoothScroll({position: $(document).height() - $w.height()});
  });
</script>
<!-- 定義選項(xiàng) -->
<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">滾動(dòng)到頂部</button>
<!-- 如果要指定滾動(dòng)的位置,可以給這個(gè)屬性設(shè)一個(gè)值。 -->
<button data-am-smooth-scroll="{position: 189}" class="am-btn am-btn-secondary">指定滾動(dòng)的位置</button>
<!--
通過 Javascript
$(window).smoothScroll([options]);
// 滾動(dòng)到底部
$('#my-button').on('click', function() {
  var $w = $(window);
  $w.smoothScroll({position: $(document).height() - $w.height()});
});
-->
<div ></div>
</body>
</html>

到此,關(guān)于“前端開發(fā)AmazeUI平滑滾動(dòng)如何實(shí)現(xiàn)”的學(xué)習(xí)就結(jié)束了,希望能夠解決大家的疑惑。理論與實(shí)踐的搭配能更好的幫助大家學(xué)習(xí),快去試試吧!若想繼續(xù)學(xué)習(xí)更多相關(guān)知識(shí),請(qǐng)繼續(xù)關(guān)注億速云網(wǎng)站,小編會(huì)繼續(xù)努力為大家?guī)?lái)更多實(shí)用的文章!

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI