DIV CSS 佈局教程網

jQuery 插件 HovertreeImg:帶圓點索引的圖片輪播
編輯:JQuery特效代碼     

HovertreeImg 是一款輕量的 jQuery 圖片輪播插件,支持圓點索引導航,可以方便地在頁面中展示多張圖片並實現自動或手動切換。本文介紹它的效果與使用方法。

效果圖:

查看效果:https://hovertree.com/jq/hovertreeimg/

下載地址:https://hovertree.com/h/bjaf/gk8mko69.htm

使用方法

首先在頁面中引入插件的樣式表,並構建輪播所需的 HTML 結構。需要注意的是,第一張圖片直接放在容器 #hovertreeimg 內,其餘圖片則包裹在 #hovertreeimgcontent 中:

<link href="jquery.hovertreeimg.css" type="text/css" rel="stylesheet"/>
<div id="hovertreeimg">
    <a href="https://hovertree.com/texiao/game/" title="見縫插針" target="_blank">
        <img src="https://hovertree.com/themes/img/jfcz.gif" alt="見縫插針" />
    </a>
    <div id="hovertreeimgcontent">
        <a href="https://hovertree.com/h/bjaf/easysector.htm" title="HTML5百分比餅圖" target="_blank">
            <img src="https://hovertree.com/themes/img/easysector.gif" alt="EasySector插件" />
        </a>
        <a href="https://hovertree.com/h/bjaf/hovertreeimg.htm" title="HovertreeImg" target="_blank">
            <img src="https://hovertree.com/jq/hovertreeimg/hovertreeimg.jpg" alt="HovertreeImg插件" />
        </a>
    </div>
</div>

接著引入 jQuery 庫與插件腳本,並通過配置項進行初始化:

<script src="https://hovertree.com/ziyuan/jquery/jquery-1.12.0.min.js"></script>
<script src="https://hovertree.com/jq/hovertreeimg/jquery.hovertreeimg.js"></script>
<script>
$("#hovertreeimg").hovertreeimg({
    "h_circlePosition": "",   // left, right, center
    "h_width": 768,
    "h_height": 66,
    "h_borderColor": "silver",
    "h_circleWidth": 14
});
</script>

配置項說明

  • h_circlePosition:圓點索引的位置,可選 left、right、center。
  • h_width 與 h_height:輪播區域的寬與高。
  • h_borderColor:邊框顏色。
  • h_circleWidth:圓點的寬度(尺寸)。

通過調整以上配置,就能快速搭建一個美觀、帶圓點索引導航的圖片輪播組件。

XML學習教程| jQuery入門知識| AJAX入門| Dreamweaver教程| Fireworks入門知識| SEO技巧| SEO優化集錦|
Copyright © DIV+CSS佈局教程網 All Rights Reserved