jQuery實現下拉框選擇圖片的功能

來源:互聯網
上載者:User

標籤:style   blog   http   color   java   使用   os   io   

  • 讓下拉框中顯示圖片,並可選擇對應圖片,讓select下拉框不僅可顯示文字,還可以顯示圖片內容。為了更生動些,這裡還加入了jQuery動畫效果,當展開Select列表的時候,圖片漸層顯示。使用了一個jQ外掛程式:imageselect.js,使用效果的朋友可以自己下載吧。
<!DOCTYPE html><head><title>支援圖片選擇的jQuery列表框外掛程式imageselect.js</title><script type="text/javascript" src="/ajaxjs/jquery-1.6.2.min.js" ></script> <script type="text/javascript" src="/jscss/demoimg/201312/imageselect.js"></script> <style>.jqis{position: relative;}.jqis_header{background-image: url(‘/jscss/demoimg/201312/dropdown_arrow.png‘);background-position: right center;background-repeat: no-repeat;cursor: pointer;}.jqis_header img{cursor: pointer;}.jqis_dropdown{padding: 5px;position: absolute;overflow-x: hidden;overflow-y: scroll;}.jqis_dropdown img{margin-right: 3px;cursor: pointer;float: left;}</style> </head> <body> <p>潛水式無堵塞排汙泵</p>

<select name="logo">
<option value="1">/jscss/demoimg/wall_s5.jpg</option><option value="2">/jscss/demoimg/wall_s8.jpg</option><option value="3">/jscss/demoimg/wall_s7.jpg</option><option value="4">/jscss/demoimg/wall_s6.jpg</option></select><script type="text/javascript">    $(document).ready(function(){        $(‘select[name=logo]‘).ImageSelect({dropdownWidth:425});    });</script></body></html>

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.