jquery.SuperSlide

1、引用jQuery.js 和 jquery.SuperSlide.js

因爲SuperSlide是基於jQuery的插件,所以前提必須先引用jQuery,再引用SuperSlide

?
1
2
3
4
5
<head>
    <script type="text/javascript" src="../jquery1.42.min.js"></script>
    <script type="text/javascript" src="../jquery.SuperSlide.2.1.1.js"></script>
</head>

2、編寫HTML

以下是默認的HTMl結構,分別是 ".hd" 裏面包含ul, ".bd" 裏面包含ul

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<div class="slideTxtBox">
    <div class="hd">
        <ul><li>教育</li><li>培訓</li><li>出國</li></ul>
    </div>
    <div class="bd">
        <ul>
            <li><a href="http://www.SuperSlide2.com" target="_blank">SuperSlide2.0正式發佈!</a></li>
            ...
        </ul>
        <ul>
            <li><a href="http://www.SuperSlide2.com" target="_blank">名師教作文:3妙招巧寫高分</a></li>
            ...
        </ul>
        <ul>
            <li><a href="http://www.SuperSlide2.com" target="_blank">澳大利亞八大名校招生說明會</a></li>
            ...
        </ul>
    </div>
</div>

3、編寫CSS,爲HTML賦予樣色

認真檢查您的css,保證兼容大部分瀏覽器前提下再調用SuperSlide

?
1
2
3
4
5
6
7
8
.slideTxtBox{ width:450px; border:1px solid #ddd; text-align:left;  }
.slideTxtBox .hd{ height:30px; line-height:30px; background:#f4f4f4; padding:0 20px; border-bottom:1px solid #dddposition:relative; }
.slideTxtBox .hd ul{ float:left; position:absolute; left:20px; top:-1px; height:32px;   }
.slideTxtBox .hd ul li{ float:left; padding:0 15px; cursor:pointer;  }
.slideTxtBox .hd ul li.on{ height:30pxbackground:#fff; border:1px solid #ddd; border-bottom:2px solid #fff; }
.slideTxtBox .bd ul{ padding:15px;  zoom:1;  }
.slideTxtBox .bd li{ height:24px; line-height:24px;   }
.slideTxtBox .bd li .date{ float:right; color:#999;  }

4、調用SuperSlide

在本例中,請在 “.slideTxtBox” div結束後立刻調用 SuperSlide,這樣會得到最好的效果,避免整個頁面加載後再調用 SuperSlide;
因爲是默認HTML結構,所以參數都爲默認值,不用填寫titCell、mainCell等。

?
1
<script type="text/javascript">jQuery(".slideTxtBox").slide(); </script>

5、效果如下:

scrolling="no" src="http://www.superslide2.com/demo/iframe/1.0-switchTab-iframe.html?" frameborder="0" style="width: 452px; height: 232px; vertical-align: middle; background: url(http://www.superslide2.com/images/loading.gif) 50% 50% no-repeat;">
常用參數(切換看看)
效果[effect]: 自動運行[autoPlay]:
觸發方式[trigger]: 緩動效果[easing]:
效果速度[delayTime]:    

當前調用代碼:jQuery(".slideTxtBox").slide({});

注意:緩動效果對於fade影響不大;不同緩動效果設置適當“效果速度”,會有最佳效果。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章