久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

單擊菜單鏈接從一個(gè) div 移動(dòng)到另一個(gè)

Moving from one div to another on click of a menu link(單擊菜單鏈接從一個(gè) div 移動(dòng)到另一個(gè))
本文介紹了單擊菜單鏈接從一個(gè) div 移動(dòng)到另一個(gè)的處理方法,對(duì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

問題描述

我想在我的網(wǎng)站上制作動(dòng)畫效果,當(dāng)我們單擊菜單鏈接(例如 about-section)時(shí),它會(huì)以視差樣式為該 div 設(shè)置動(dòng)畫.

I want to make an animation effect on my website where, when we click on a menu link (say, about-section), it will animate to that div in a parallax style.

如果你知道任何可以在這方面幫助我的 jquery 插件,那么請(qǐng)告訴我,如果你也向我展示一個(gè)例子會(huì)更好.

So guys if you know any jquery plugin that can help me in this context, then please let me know, and it would be better if you demonstrate me a example of that as well.

查看代碼獲取幫助:

.Home-section {
  height: 500px;
  background: deepskyblue;
}
.About-section {
  height: 300px;
  background: deeppink;
}

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js"></script>

<a href="#">Home</a>
<a href="#">About</a>

<div class="Home-section">
  <h1> Hello </h1>
</div>

<div class="About-section">
  <h1>Bye</h1>
</div>

所以,根據(jù)我想要?jiǎng)赢嫷?strong>About-section的代碼,點(diǎn)擊鏈接說明About

So, According to the code i want to animate to About-section on click on the link stating About

推薦答案

希望你想要這個(gè).謝謝

// handle links with @href started with '#' only
$(document).on('click', 'a[href^="#"]', function(e) {
    // target element id
    var id = $(this).attr('href');

    // target element
    var $id = $(id);
    if ($id.length === 0) {
        return;
    }

    // prevent standard hash navigation (avoid blinking in IE)
    e.preventDefault();

    // top position relative to the document
    var pos = $(id).offset().top - 10;

    // animated top scrolling
    $('body, html').animate({scrollTop: pos});
});

.Home-section {
  height:500px;
  background: deepskyblue;
  }

.About-section {
  height:300px;
  background:deeppink;
  }

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>

<a href="#home">Home</a>
<a href="#about">About</a>

<div class="Home-section" id="home"><h1> Hello </h1>
  </div>

<div class="About-section" id="about"><h1>Bye</h1>
  </div>

這篇關(guān)于單擊菜單鏈接從一個(gè) div 移動(dòng)到另一個(gè)的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

jQuery/JavaScript Library for avatar creation?(用于創(chuàng)建頭像的 jQuery/JavaScript 庫(kù)?)
How to do following mask input problem?(如何做以下掩碼輸入問題?)
Issues Setting Value/Label Using DropKick Javascript(使用 DropKick Javascript 設(shè)置值/標(biāo)簽的問題)
how to unit-test private methods in jquery plugins?(如何對(duì) jquery 插件中的私有方法進(jìn)行單元測(cè)試?)
stellar.js - configuring offsets / aligning elements for a vertical scrolling website?(stellar.js - 為垂直滾動(dòng)網(wǎng)站配置偏移量/對(duì)齊元素?)
jQuery masked input plugin. select all content when textbox receives focus(jQuery 屏蔽輸入插件.當(dāng)文本框獲得焦點(diǎn)時(shí)選擇所有內(nèi)容)
主站蜘蛛池模板: 欧美国产日韩在线观看成人 | 日韩毛片免费看 | 中文字幕免费在线 | www.亚洲视频 | 91九色视频在线 | 国产一级电影在线 | 日本天天色 | 美国一级黄色片 | 黄色小视频大全 | 很黄很污的网站 | 亚洲91精品 | 亚洲精品播放 | 在线一区视频 | 亚洲成av人片在线观看 | 免费av毛片| 国产一区二区三区四区区 | 亚洲九色| 久久久久久久久久久久久久久久久久久久 | 99久久夜色精品国产亚洲96 | 亚洲电影一级片 | 久热精品在线播放 | 亚洲精品一二区 | 一级做a毛片 | 亚洲国产精品视频 | 色综合九九 | 欧美日韩在线综合 | 欧美性网| 午夜精品福利视频 | 日韩精品在线观看一区二区 | 在线中文一区 | 国产精品视频一二三区 | 免费国产一区 | 国产成人精品一区二区 | 在线免费观看黄a | 日韩欧美专区 | 密色视频 | 天天爽网站 | 黄色在线免费播放 | 日韩免费av| 91国产在线视频在线 | 九九伊人sl水蜜桃色推荐 |