jquery實(shí)現(xiàn)簡(jiǎn)單手風(fēng)琴菜單效果實(shí)例
更新時(shí)間:2015年06月13日 12:49:45 作者:不吃皮蛋
這篇文章主要介紹了jquery實(shí)現(xiàn)簡(jiǎn)單手風(fēng)琴菜單效果的方法,實(shí)例分析了jQuery操作頁(yè)面樣式、html頁(yè)面布局及SCSS樣式設(shè)置的相關(guān)技巧,需要的朋友可以參考下
本文實(shí)例講述了jquery實(shí)現(xiàn)簡(jiǎn)單手風(fēng)琴菜單效果的方法。分享給大家供大家參考。具體實(shí)現(xiàn)方法如下:
(function($) { var allPanels = $('.accordion > dd').hide(); $('.accordion > dt > a').click(function() { allPanels.slideUp(); $(this).parent().next().slideDown(); return false; }); })(jQuery);
HTML代碼:
<dl class="accordion"> <dt><a href="">Panel 1</a></dt> <dd>Pellentesque fermentum dolor. Aliquam quam lectus, facilisis auctor, ultrices ut, elementum vulputate, nunc.</dd> <dt><a href="">Panel 2</a></dt> <dd>Donec nec justo eget felis facilisis fermentum. Aliquam porttitor mauris sit amet orci. Aenean dignissim pellentesque felis.</dd> <dt><a href="">Panel 3</a></dt> <dd>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Phasellus hendrerit. Pellentesque aliquet nibh nec urna. In nisi neque, aliquet vel, dapibus id, mattis vel, nisi. Sed pretium, ligula sollicitudin laoreet viverra, tortor libero sodales leo, eget blandit nunc tortor eu nibh. Nullam mollis. Ut justo. Suspendisse potenti.</dd> </dl>
SCSS部分:
/* Sorry if you don't use SASS. Should be pretty easy to convert. */ .accordion { margin: 50px; dt, dd { padding: 10px; border: 1px solid black; border-bottom: 0; &:last-of-type { border-bottom: 1px solid black; } a { display: block; color: black; font-weight: bold; } } dd { border-top: 0; font-size: 12px; &:last-of-type { border-top: 1px solid white; position: relative; top: -1px; } } }
希望本文所述對(duì)大家的jQuery程序設(shè)計(jì)有所幫助。
您可能感興趣的文章:
- jQuery Easyui使用(一)之可折疊面板的布局手風(fēng)琴菜單
- jQuery制作效果超棒的手風(fēng)琴折疊菜單
- 基于Jquery代碼實(shí)現(xiàn)手風(fēng)琴菜單
- jQuery多級(jí)手風(fēng)琴菜單實(shí)例講解
- 基于jQuery實(shí)現(xiàn)以手風(fēng)琴方式展開和折疊導(dǎo)航菜單
- 基于JQuery的一句話搞定手風(fēng)琴菜單
- jquery實(shí)現(xiàn)下拉菜單的手風(fēng)琴效果
- 基于jQuery實(shí)現(xiàn)手風(fēng)琴菜單、層級(jí)菜單、置頂菜單、無(wú)縫滾動(dòng)效果
- Jquery 垂直多級(jí)手風(fēng)琴菜單附源碼下載
- jQuery插件實(shí)現(xiàn)手風(fēng)琴二級(jí)菜單
相關(guān)文章
使用jquery自定義鼠標(biāo)樣式滿足個(gè)性需求
瀏覽器是有自帶的鼠標(biāo)樣式的,如果某些時(shí)候?yàn)榱吮3质髽?biāo)樣式的統(tǒng)一,或者想指定特定的鼠標(biāo)樣式該怎么辦呢?那就要使用自定義了,下面有個(gè)不錯(cuò)的示例,喜歡的朋友可以參考下2013-11-11jQuery動(dòng)態(tài)添加及刪除表單上傳元素的方法(附demo源碼下載)
這篇文章主要介紹了jQuery動(dòng)態(tài)添加及刪除表單上傳元素的方法,涉及jQuery的事件動(dòng)態(tài)綁定及頁(yè)面元素動(dòng)態(tài)操作技巧,并附帶了demo源碼供讀者下載參考,代碼非常簡(jiǎn)潔實(shí)用,需要的朋友可以參考下2016-01-01jQuery設(shè)置和移除文本框默認(rèn)值的方法
這篇文章主要介紹了jQuery設(shè)置和移除文本框默認(rèn)值的方法,實(shí)例分析了jQuery操作文本框的技巧,具有一定參考借鑒價(jià)值,需要的朋友可以參考下2015-03-03