首先引入jQuery库和pagewalkthrough插件。
1 2 3  | <link type="text/css" rel="stylesheet" href="jquery.pagewalkthrough.css" />  <script type="text/javascript" src="jquery.min.js"></script>  <script type="text/javascript" src="jquery.pagewalkthrough.min.js"></script> | 
然后我们在#walkthrough-content加入隐藏引导内容,就是每一步展示的内容,等会用pagewalkthrough插件调用。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21  | <div class="main"><div class="w1"></div>           <div class="w2"></div>    <div id="walkthrough-2">                    jQuery插件库LOGO,点击这里可以跳转到网站首页。     </div>    <div class="w3"></div>    <div id="walkthrough-3">                    第二部演示     </div>    <div class="w4"></div>    <div id="walkthrough-4">                    第三部演示    </div>        <div id="walkthrough-5">                    第四部演示    </div>       <img src="img/jq22.jpg"></div> | 
pagewalkthrough插件中steps是一个数组,定义每一步引导调用的内容,下面我们讲解这几个参数。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50  | $(function() {    // 设置参数    $('body').pagewalkthrough({        name: 'introduction',        steps: [{            popup: { //定义弹出提示引导层                content: '#walkthrough-1',                type: 'modal'            }        },        {            wrapper: '.w1',            //当前引导对应的元素位置            popup: {                content: '#walkthrough-2',                //关联的内容元素                type: 'tooltip',                //弹出方式(tooltip和modal以及nohighlight)                position: 'bottom' //弹出层位置(top,left, right or bottom)            }        },        {            wrapper: '.w2',            popup: {                content: '#walkthrough-3',                type: 'tooltip',                position: 'bottom'            }        },        {            wrapper: '.w3',            popup: {                content: '#walkthrough-4',                type: 'tooltip',                position: 'top'            }        },        {            wrapper: '.w4',            popup: {                content: '#walkthrough-5',                type: 'tooltip',                position: 'top'            }        }]    });    // 一步一步显示引导页    $('body').pagewalkthrough('show');}); | 
| 参数 | 描述 | 默认值 | 
| popup | 弹出提示引导层 | |
| wrapper | 当前引导对应的元素位置 | |
| type | 弹出方式(tooltip和modal以及nohighlight) | tooltip | 
| position | 弹出层位置(top,left, right or bottom) | bottom | 
| offsetHorizontal | 是否水平显示 | 0 | 
| offsetVertical | 是否垂直显示 | 0 | 
| width | 弹出层宽度 | 320 | 
| contentRotation | 是否跳过 默认不跳过 | 0 | 
| autoScroll | 是否自动滚动 | true | 
| scrollSpeed | 滚动速度 单位毫秒 | 1000 | 
| lockScrolling | 是否锁定滚动 默认不锁 | false | 
| onEnter | 当按enter回调 | null | 
| onLeave | 当结束回调 | null | 
特别申明:
			本站所有资源都是由网友投稿发布,或转载各大下载站,请自行检测软件的完整性!
			本站所有资源仅供学习与参考,请勿用于商业用途,否则产生的一切后果将由您自己承担!
			如有侵权请联系我们删除下架,联系方式:lei1294551502@163.com