Akordeon可折叠手风琴jQ插件特效代码

版权:原创 更新时间:1年以上
[该文章底部包含文件资源,可根据自己情况,决定是否下载资源使用,时间>金钱,如有需要,立即查看资源]

以下是 Akordeon可折叠手风琴jQ插件特效代码 的示例演示效果:

当前平台(PC电脑)
  • 平台:

部分效果截图:

Akordeon可折叠手风琴jQ插件特效代码

HTML代码(index.html):

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Akordeon可折叠手风琴jQuery插件</title>
    <script src="js/jquery.min.js" type="text/javascript"></script>
    <link href="css/jquery.akordeon.css" rel="stylesheet" type="text/css" />
    <link href="css/demo.css" rel="stylesheet" type="text/css" />
    <script src="js/jquery.akordeon.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            $('#buttons').akordeon();
            $('#button-less').akordeon({ buttons: false, toggle: true, itemsOrder: [2, 0, 1] });
        });
    </script>
    <style type="text/css">
        .demobar
        {
            height: 90px;
            line-height: 90px;
        }
        .demobar .fleft
        {
            float: left;
            margin-left: 10px;
        }
        .demobar .fright
        {
            float: right;
            margin-top: 14px;
            margin-right: 10px;
        }
    </style>
</head>
<body>
    <div id="demo-wrapper">
        <div class="akordeon" id="buttons">
            <div class="akordeon-item expanded">
                <div class="akordeon-item-head">
                    <div class="akordeon-item-head-container">
                        <div class="akordeon-heading">
                            SOUPS
                        </div>
                    </div>
                </div>
                <div class="akordeon-item-body">
                    <div class="akordeon-item-content">
                        <p>
                            <ul>
                                <li>
                                    <h6>
                                        Vegetable Consomme Light</h6>
                                    <p>
                                        Clear Soup Made With Seasonal Vegetable and Flavoured With Clashi And Rice Noodles</p>
                                </li>
                                <li>
                                    <h6>
                                        Red Pepper and Tomato Soup</h6>
                                    <p>
                                        An Intensely full flavored soup with herbs and crème fraiche</p>
                                </li>
                                <li>
                                    <h6>
                                        Seafood Chowder Assortment of shrimp</h6>
                                    <p>
                                        Squid and fish in a classic New England bisque</p>
                                </li>
                            </ul>
                        </p>
                    </div>
                </div>
            </div>
            <div class="akordeon-item">
                <div class="akordeon-item-head">
                    <div class="akordeon-item-head-container">
                        <div class="akordeon-heading">
                            Second Panel
                        </div>
                    </div>
                </div>
                <div class="akordeon-item-body">
                    <div class="akordeon-item-content">
                        <a href="#">
                            <img id="social-media-share" width="150px" height="100px" style="border: none; float: left;
                                margin-right: 10px;" src="images/jQuery-minimal-social-media-share-plugin.jpg" /></a>
                        Donec tortor velit, volutpat id adipiscing ut, tincidunt vitae mi. Duis imperdiet
                        egestas fermentum. Sed a leo mauris. Vestibulum metus libero, condimentum commodo
                        cursus sit amet, accumsan hendrerit eros. Suspendisse orci magna, eleifend at fermentum
                        id, condimentum faucibus libero. Integer tempus fermentum odio, in congue sem lacinia
                        pharetra. Phasellus pretium convallis eros, vitae pulvinar libero elementum non.
                        Donec et hendrerit massa. Integer ac aliquet tellus. Quisque sollicitudin augue
                        eget justo convallis vel consequat lacus bibendum. Integer laoreet nunc non arcu
                        lacinia malesuada at sed elit.
                    </div>
                </div>
            </div>
            <div class="akordeon-item">
                <div class="akordeon-item-head">
                    <div class="akordeon-item-head-container">
                        <div class="akordeon-heading">
                            Third Panel
                        </div>
                    </div>
                </div>
                <div class="akordeon-item-body">
                    <div class="akordeon-item-content">
                        <p>
                            Nullam congue erat id felis tristique tincidunt. In tincidunt mi sit amet sapien
                            ornare facilisis. Suspendisse lacus elit, consequat non rutrum vel, vestibulum quis
                            libero. In elementum laoreet eros, faucibus rhoncus felis tempor eget. Maecenas
                            urna arcu, adipiscing vitae tempus id, gravida eu odio. Donec vestibulum feugiat
                            commodo. Duis quis ante massa.</p>
                        <p>
                            Nullam molestie, ligula quis tincidunt tincidunt, eros ipsum scelerisque lorem,
                            commodo fermentum tellus ligula sit amet sem. Phasellus quis nunc id velit egestas
                            malesuada nec eu nunc. Fusce nec metus vitae metus mattis volutpat.</p>
                    </div>
                </div>
            </div>
        </div>
        <div class="akordeon" id="button-less">
            <div class="akordeon-item expanded">
                <div class="akordeon-item-head">
                    <div class="akordeon-item-head-container">
                        <div class="akordeon-heading">
                            First Panel
                        </div>
                    </div>
                </div>
                <div class="akordeon-item-body">
                    <div class="akordeon-item-content">
                        Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam non nibh nec sem
                        placerat ornare. Duis venenatis, mi a pretium laoreet, odio justo dapibus tortor,
                        vel suscipit ante dolor vel ante. Ut at eleifend nunc. In velit libero, sagittis
                        non imperdiet sed, malesuada et libero. Phasellus quis accumsan urna. Ut cursus
                        condimentum quam, in eleifend magna tempus a. Curabitur dui ipsum, placerat sed
                        porttitor a, congue quis quam. Suspendisse at dolor massa. Curabitur eget elit dolor,
                        nec vulputate ipsum. Vestibulum sit amet metus id metus ullamcorper facilisis et
                        dignissim est. In lectus eros, scelerisque id accumsan id, bibendum eu dolor. Donec
                        sodales erat ut lectus rhoncus condimentum. Mauris eleifend scelerisque nulla eget
                        egestas.
                    </div>
                </div>
            </div>
            <div class="akordeon-item">
                <div class="akordeon-item-head">
                    <div class="akordeon-item-head-container">
                        <div class="akordeon-heading">
                            Second Panel
                        </div>
                    </div>
                </div>
                <div class="akordeon-item-body">
                    <div class="akordeon-item-content">
                        Donec tortor velit, volutpat id adipiscing ut, tincidunt vitae mi. Duis imperdiet
                        egestas fermentum. Sed a leo mauris. Vestibulum metus libero, condimentum commodo
                        cursus sit amet, accumsan hendrerit eros. Suspendisse orci magna, eleifend at fermentum
                        id, condimentum faucibus libero. Integer tempus fermentum odio, in congue sem lacinia
                        pharetra. Phasellus pretium convallis eros, vitae pulvinar libero elementum non.
                        Donec et hendrerit massa. Integer ac aliquet tellus. Quisque sollicitudin augue
                        eget justo convallis vel consequat lacus bibendum. Integer laoreet nunc non arcu
                        lacinia malesuada at sed elit.
                    </div>
                </div>
            </div>
            <div class="akordeon-item">
                <div class="akordeon-item-head">
                    <div class="akordeon-item-head-container">
                        <div class="akordeon-heading">
                            Third Panel
                        </div>
                    </div>
                </div>
                <div class="akordeon-item-body">
                    <div class="akordeon-item-content">
                        <p>
                            Nullam congue erat id felis tristique tincidunt. In tincidunt mi sit amet sapien
                            ornare facilisis. Suspendisse lacus elit, consequat non rutrum vel, vestibulum quis
                            libero. In elementum laoreet eros, faucibus rhoncus felis tempor eget. Maecenas
                            urna arcu, adipiscing vitae tempus id, gravida eu odio. Donec vestibulum feugiat
                            commodo. Duis quis ante massa.</p>
                        <p>
                            Nullam molestie, ligula quis tincidunt tincidunt, eros ipsum scelerisque lorem,
                            commodo fermentum tellus ligula sit amet sem. Phasellus quis nunc id velit egestas
                            malesuada nec eu nunc. Fusce nec metus vitae metus mattis volutpat.</p>
                    </div>
                </div>
            </div>
        </div>
    </div>
</body>
</html>


JS代码(jquery.akordeon.js):

(function ($){
	$.fn.extend({
	akordeon:function (options){
	var settings = $.extend({
	expandedItem:0,expandSpeed:200,toggle:false,expandText:'&ndash;
	',collapseText:'+',buttons:true,hiddenItem:-1,itemsOrder:[]}
,options);
	return this.each(function (){
	var expandedItem = settings.expandedItem;
	var speed = settings.expandSpeed;
	var expandText = settings.expandText;
	var collapseText = settings.collapseText;
	var isToggle = settings.toggle;
	var akordeon = $(this);
	if (!akordeon.hasClass('akordeon')) akordeon.addClass('akordeon');
	if (settings.itemsOrder != null && settings.itemsOrder != undefined && settings.itemsOrder.length > 0){
	if (settings.itemsOrder.length != akordeon.find('.akordeon-item').length){
	alert('Parameter value mismatch with total items');
}
else{
	var items = akordeon.find('.akordeon-item').clone(true);
	akordeon.find('.akordeon-item').remove();
	$(settings.itemsOrder).each(function (){
	akordeon.append(items.eq(this));
}
);
}
}
$('.akordeon-item',akordeon).each(function (){
	var body = $(this).find('.akordeon-item-body');
	var h = body.outerHeight();
	body.data('h',h);
	$(this).find('.akordeon-item-head').addClass('akordeon-border-bottom');
	body.addClass('akordeon-border-bottom');
	if (settings.buttons) $(this).find('.akordeon-item-head-container').prepend('<div class="akordeon-icon"><span>' + collapseText + '</span></div>');
}
);
	if (settings.hiddentItem > -1){
	var hiddenItem = $('.akordeon-item',akordeon).eq(settings.hiddenItem).hide();
	hiddenItem.find('.akordeon-item-head',akordeon).last().removeClass('akordeon-border-bottom');
	hiddenItem.find('.akordeon-item-body',akordeon).last().removeClass('akordeon-border-bottom');
}
$('.akordeon-item .akordeon-item-head',akordeon).last().removeClass('akordeon-border-bottom');
	$('.akordeon-item .akordeon-item-body',akordeon).last().removeClass('akordeon-border-bottom');
	$('.akordeon-item:first').addClass('akordeon-item-first');
	$('.akordeon-item:last').addClass('akordeon-item-last');
	$('.akordeon-item',akordeon).removeClass('expanded').addClass('collapsed');
	$('.akordeon-item.collapsed .akordeon-item-body',akordeon).css({
	height:0}
);
	expandItem($('.akordeon-item',akordeon).eq(expandedItem));
	$('.akordeon-item-head-container',akordeon).click(function (){
	var currentItem = $(this).parents('.akordeon-item');
	var previousItem = akordeon.find('.akordeon-item.expanded');
	var isExpanded = currentItem.hasClass('expanded');
	if (!isToggle){
	if (!isExpanded){
	collapseItem(previousItem);
	expandItem(currentItem);
}
}
else{
	if (isExpanded) collapseItem(currentItem);
	else expandItem(currentItem);
}
}
);
	function expandItem(item){
	var body = item.find('.akordeon-item-body');
	var h = body.data('h');
	body.animate({
	height:h}
,speed,function (){
	item.removeClass('collapsed').addClass('expanded').find('.akordeon-icon span').html(expandText);
}
);
}
function collapseItem(item){
	var body = item.find('.akordeon-item-body');
	body.animate({
	height:0}
,speed,function (){
	item.removeClass('expanded').addClass('collapsed').find('.akordeon-icon span').html(collapseText);
}
);
}
}
);
}
}
);
}
)(jQuery);
	

CSS代码(demo.css):

*{padding:0;margin:0;}
body{background-image:url(../images/pattern.jpg);}
#demo-wrapper{width:600px;margin:40px auto;}
#button-less{margin-top:20px;}
#button-less .akordeon-item-head-container{left:0px !important;}

CSS代码(jquery.akordeon.css):

.akordeon{width:616px;border:solid 1px black;color:White;font-family:Arial;font-size:12px;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;behavior:url(PIE.htc);}
.akordeon-item{position:relative;}
.akordeon-item .akordeon-item-head{height:44px;background:#4B4B4B;/* Old browsers */
 background-image:-webkit-gradient(linear,0% 0%,0% 100%,from(#4b4b4b),to(#303030));background-image:-moz-linear-gradient(#4b4b4b,#303030);background-image:-webkit-linear-gradient(#4b4b4b,#303030);background-image:-o-linear-gradient(#4b4b4b,#303030);background:-ms-linear-gradient(#4b4b4b,#303030);background:linear-gradient(#4b4b4b,#303030);filter:progid:DXImageTransform.Microsoft.gradient( startColorstr='#4b4b4b',endColorstr='#303030',GradientType=0 );/* IE6-9 */
 /*position:relative;*/
 padding-top:14px;}
.akordeon-item .akordeon-item-body{background:#424242;/* Old browsers */
 background-image:-webkit-gradient(linear,0% 0%,0% 100%,from(#424242),to(#303030));background-image:-moz-linear-gradient(#424242,#303030);background-image:-webkit-linear-gradient(#424242,#303030);background-image:-o-linear-gradient(#424242,#303030);background:-ms-linear-gradient(#424242,#303030);background:linear-gradient(#424242,#303030);filter:progid:DXImageTransform.Microsoft.gradient( startColorstr='#424242',endColorstr='#303030',GradientType=0 );/* IE6-9 */
 /* min-height:100px;padding:10px;*/
 border-bottom:none;overflow:hidden;}
.akordeon-icon{width:34px;height:30px;background:#c9f055;/* Old browsers */
 background-image:-webkit-gradient(linear,0% 0%,0% 100%,from(#c9f055),to(#95e21a));background-image:-moz-linear-gradient(#c9f055,#95e21a);background-image:-webkit-linear-gradient(#c9f055,#95e21a);background-image:-o-linear-gradient(#c9f055,#95e21a);background:-ms-linear-gradient(#c9f055,#95e21a);background:linear-gradient(#c9f055,#95e21a);filter:progid:DXImageTransform.Microsoft.gradient( startColorstr='#c9f055',endColorstr='#95e21a',GradientType=0 );/* IE6-9 */
 border-radius:4px;-moz-border-radius:4px;-webkit-border-radius:4px;/* position:absolute;left:-8px;top:14px;*/
 padding:0;margin:0;float:left;cursor:pointer;behavior:url(PIE.htc);}
.akordeon-heading{float:left;padding-left:10px;padding-top:8px;font-weight:bold;}
.akordeon-icon span{color:#83a626;font-size:36px;position:absolute;left:6px;top:-6px;font-weight:bold;text-align:center;}
.akordeon-item.expanded .akordeon-icon span{top:-9px;}
.akordeon-item-head-container{width:100%;position:absolute;left:-8px;cursor:pointer;}
.akordeon-item.expanded .akordeon-item-body{border-top:solid 1px #5c5c5c;}
.akordeon-item.collapsed{}
.akordeon-item.expanded .akordeon-heading{color:#c9f055;}
.akordeon-item.expanded .akordeon-item-head{background:#424242 !important;/* Old browsers */
 background-image:-webkit-gradient(linear,0% 0%,0% 100%,from(#424242),to(#303030)) !important;background-image:-moz-linear-gradient(#424242,#303030) !important;background-image:-webkit-linear-gradient(#424242,#303030) !important;background-image:-o-linear-gradient(#424242,#303030) !important;background:-ms-linear-gradient(#424242,#303030) !important;background:linear-gradient(#424242,#303030) !important;filter:progid:DXImageTransform.Microsoft.gradient( startColorstr='#424242',endColorstr='#303030',GradientType=0 ) !important;/* IE6-9 */
 /* -webkit-box-shadow:0px 10px 0px rgba(92,92,92,0.75);-moz-box-shadow:0px 10px 0px rgba(92,92,92,0.75);box-shadow:0px 10px 0px rgba(92,92,92,0.75);*/
}
.akordeon-item-content{padding:10px;min-height:120px;height:180px;overflow:auto;}
.akordeon-border-bottom{border-bottom:solid 1px black;}
.akordeon-border-top{border-top:solid 1px black;}
.akordeon-item.expanded .akordeon-item-body.akordeon-border-bottom{border-bottom:solid 1px black !important;}
.akordeon-item.akordeon-item-first .akordeon-item-head{-webkit-border-top-left-radius:4px;-webkit-border-top-right-radius:4px;-moz-border-radius-topleft:4px;-moz-border-radius-topright:4px;border-top-left-radius:4px;border-top-right-radius:4px;behavior:url(PIE.htc);}
.akordeon-item.akordeon-item-last.collapsed .akordeon-item-head{-webkit-border-bottom-right-radius:4px;-webkit-border-bottom-left-radius:4px;-moz-border-radius-bottomright:4px;-moz-border-radius-bottomleft:4px;border-bottom-right-radius:4px;border-bottom-left-radius:4px;border-bottom:none;behavior:url(PIE.htc);}
.akordeon-item.akordeon-item-last.expanded .akordeon-item-head{-webkit-border-bottom-right-radius:0px;-webkit-border-bottom-left-radius:0px;-moz-border-radius-bottomright:0px;-moz-border-radius-bottomleft:0px;border-bottom-right-radius:0px;border-bottom-left-radius:0px;border-bottom:solid 1px black;behavior:url(PIE.htc);}
.akordeon-item.akordeon-item-last.expanded .akordeon-item-body{-webkit-border-bottom-right-radius:4px;-webkit-border-bottom-left-radius:4px;-moz-border-radius-bottomright:4px;-moz-border-radius-bottomleft:4px;border-bottom-right-radius:4px;border-bottom-left-radius:4px;behavior:url(PIE.htc);}
附件:下载该文件资源,减少时间成本(增值服务)
留言
该资源可下载
File Source
.rar
80.63 KB
Html Js 手拉琴特效
最新结算
股权转让协议意向书模板
类型: .docx 金额: CNY 2.23¥ 状态: 待结算 详细>
股权转让协议意向书模板
类型: .docx 金额: CNY 0.28¥ 状态: 待结算 详细>
CSS3图片向上3D翻转渐隐消失特效
类型: .rar 金额: CNY 0.29¥ 状态: 待结算 详细>
CSS3图片向上3D翻转渐隐消失特效
类型: .rar 金额: CNY 2.31¥ 状态: 待结算 详细>
.net c# 将金额转人名币大写金额
类型: .rar 金额: CNY 2.39¥ 状态: 待结算 详细>
.net c# 将金额转人名币大写金额
类型: .rar 金额: CNY 0.3¥ 状态: 待结算 详细>
合伙退伙协议书范本模板
类型: .doc 金额: CNY 2.23¥ 状态: 待结算 详细>
合伙退伙协议书范本模板
类型: .doc 金额: CNY 0.28¥ 状态: 待结算 详细>
合伙退伙协议书范本模板
类型: .doc 金额: CNY 2.23¥ 状态: 待结算 详细>
合伙退伙协议书范本模板
类型: .doc 金额: CNY 0.28¥ 状态: 待结算 详细>
我们力求给您提供有用的文章,再此基础上,会附加营收资源,不做任何广告,让平台可以更好发展 若您发现您的权利被侵害,或使用了您的版权,请发邮件联系 sunlifel@foxmail.com ggbig觉得 : 不提供源码的文章不是好文章
合作伙伴
联系我们
  • QQ:21499807
  • 邮箱:sunlifel@foxmail.com
  • QQ扫一扫加QQ
    QQ扫一扫
Copyright 2023-2024 ggbig.com·皖ICP备2023004211号-1
打赏文章