jQuery外掛程式實現的頁面功能介紹引導頁效果

來源:互聯網
上載者:User

標籤:

新產品上線或是改版升級,我們會在使用者第一次使用產品時建立一個使用嚮導,引導使用者如何使用產品,如使用示範的方式逐一介紹介面上的功能模組,從而提升了使用者體驗和產品的親和力。

Helloweba.com之前也有相關文章介紹:《構建一個用於產品介紹的WEB應用》,相信對有需要的朋友有協助。本文將介紹另一款基於jQuery的頁面引導頁外掛程式:pagewalkthrough.js,來看如何使用它。

先點擊這裡可以看線上示範效果

HTML

首先記得載入所需的css檔案和jQuery庫檔案,以及pagewalkthrough外掛程式。

 
<!-- CSS --> <link type="text/css" rel="stylesheet" href="css/jquery.pagewalkthrough.css" />  <!-- jQuery --> <script type="text/javascript" src="jquery.min.js"></script> <!-- Page walkthrough plugin --> <script type="text/javascript" src="jquery.pagewalkthrough.min.js"></script> 
 

接著,我們在頁面的最下部加入引導內容,就是每一步需要展示的內容,預設先隱藏內容,等會用jQuery調用。

 
<div id="walkthrough-content">     <div id="walkthrough-1">         <h3>歡迎來到Helloweba樣本DEMO示範頁</h3>          <p>頁面功能介紹引導頁的效果是通過一款叫做pagewalkthrough.js的jQuery外掛程式實現的。</p>         <p>點擊下一步瞭解更多...</p>     </div>      <div id="walkthrough-2">         這裡是Helloweba網站LOGO,點擊這裡可以直通網站首頁。     </div>      <div id="walkthrough-3">         點擊這裡可以直接看外掛程式的使用教程。     </div>      <div id="walkthrough-4">         點擊這裡去下載源碼,免費的哦。。     </div>      <div id="walkthrough-5">         這是頁尾和著作權資訊。     </div> </div> 

 

 

引導內容支援html內容,你可以在裡面加入連結、圖片等資訊。還有就是引導頁所需的箭頭圖片已經打包好,直接用css調用,關於字型,你可以調用外部字型,如手寫字型可能效果更好。

jQuery

你完全可以在頁面底部加入如下代碼來調用pagewalkthrough,關鍵選項steps是一個數組,定義每一步引導調用的內容,參數wrapper定義了當前引導對應的元素位置,參數popup定義彈出提示引導層,參數content定義關聯的內容元素,參數type定義彈出方式,包括tooltip和modal以及nohighlight三種方式,參數position定義了彈出層位置,包括top,left, right or bottom。

 
$(function() {     $(‘body‘).pagewalkthrough({         name: ‘introduction‘,         steps: [{            popup: {                content: ‘#walkthrough-1‘,                type: ‘modal‘            }         }, {             wrapper: ‘#logo‘,             popup: {                 content: ‘#walkthrough-2‘,                 type: ‘tooltip‘,                 position: ‘bottom‘             }         }, {             wrapper: ‘h2.top_title a‘,             popup: {                 content: ‘#walkthrough-3‘,                 type: ‘tooltip‘,                 position: ‘bottom‘             }         }, {             wrapper: ‘a[href="http://www.helloweba.com/down-286.html"]‘,             popup: {                 content: ‘#walkthrough-4‘,                 type: ‘tooltip‘,                 position: ‘right‘             }         }, {             wrapper: ‘#footer p‘,             popup: {                 content: ‘#walkthrough-5‘,                 type: ‘tooltip‘,                 position: ‘top‘             }         }]     });      // Show the tour     $(‘body‘).pagewalkthrough(‘show‘); }); 

 

 

儲存之後,運行就能看到你要的效果。pagewalkthrough.js外掛程式官方提供了很多參數配置,包括設定彈出層寬度、捲動速度,是否自動滾動,鎖定滾動,以及多種回呼函數,定義上一步下一步按鈕,以及方法調用等等,這些本文不再描述,有興趣的朋友可以移步到項目官網瞭解更多:https://github.com/jwarby/jquery-pagewalkthrough

jQuery外掛程式實現的頁面功能介紹引導頁效果

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.