javascript - make jquery ui accordion horizontal - Stack Overflow

I am using jquery ui accordion to view different data to user, it's working perfectly as described

I am using jquery ui accordion to view different data to user, it's working perfectly as described in jquery ui/demos, however what I want to achieve is to change the effect of the sliding effect such that instead of sliding up and down, i want to make it slide left and right (like image catalouges, visual design in this page +horizontal&sp=1) so is it possible to do that? javascript:

$(function() {
                $("#accordion").accordion({autoHeight:false, collapsible: true, navigation: true,
                    clearStyle: true,
                    change: function(event, ui) {
                        resize_iframe();
                    }
                });
            });

code:

echo '<div id="accordion">';
        while ($r = mysql_fetch_assoc($get_role)) {
            $role = $r['role'];
            if ($role == 'author') {
                echo '<h3><a href="#">Author</a></h3>';
                echo "<div>";
                AuthorView($member_id, $conference_id, $start, $end, $today);
                echo "</div>";
            } else if ($role == 'organizer') {
                echo '<h3><a href="#">Organizer</a></h3>';
                echo "<div>";
                OrganizerView($conference_id, $end);
                echo "</div>";
            } else if ($role == 'reviewer') {
                echo '<h3><a href="#">Reviewer</a></h3>';
                echo "<div>";
                ReviewerView($member_id, $conference_id, $start, $end, $today);
                echo "</div>";
            }
        }
        echo "</div>";

I am using jquery ui accordion to view different data to user, it's working perfectly as described in jquery ui/demos, however what I want to achieve is to change the effect of the sliding effect such that instead of sliding up and down, i want to make it slide left and right (like image catalouges, visual design in this page http://wiki.jqueryui./w/page/12137702/Accordion?SearchFor=accordion+horizontal&sp=1) so is it possible to do that? javascript:

$(function() {
                $("#accordion").accordion({autoHeight:false, collapsible: true, navigation: true,
                    clearStyle: true,
                    change: function(event, ui) {
                        resize_iframe();
                    }
                });
            });

code:

echo '<div id="accordion">';
        while ($r = mysql_fetch_assoc($get_role)) {
            $role = $r['role'];
            if ($role == 'author') {
                echo '<h3><a href="#">Author</a></h3>';
                echo "<div>";
                AuthorView($member_id, $conference_id, $start, $end, $today);
                echo "</div>";
            } else if ($role == 'organizer') {
                echo '<h3><a href="#">Organizer</a></h3>';
                echo "<div>";
                OrganizerView($conference_id, $end);
                echo "</div>";
            } else if ($role == 'reviewer') {
                echo '<h3><a href="#">Reviewer</a></h3>';
                echo "<div>";
                ReviewerView($member_id, $conference_id, $start, $end, $today);
                echo "</div>";
            }
        }
        echo "</div>";
Share Improve this question asked Jul 29, 2012 at 21:12 Samer El GendySamer El Gendy 1,6832 gold badges23 silver badges47 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 0

Two working demos, whichever suits you for the cause: http://jsfiddle/g4NLf/

Edit: new demo: http://jsfiddle/g4NLf/ or http://jsfiddle/g4NLf/show

One uses a simple accordion, and another use a small lib for.

http://nicolahibbert./demo/liteAccordion/

HTML is in the demo link.

Code

$('.accordion').accordion({collapsible:true,active:false});

or

$(function(){
    $('#one').liteAccordion({
                        containerWidth:400,
                        autoPlay : true,
                        pauseOnHover : true,
                        theme : 'dark',
                        rounded : true,
                        enumerateSlides : true                    
                })
    
})

Scripts:

<script src="http://nicolahibbert./demo/liteAccordion/js/liteaccordion.jquery.js"></script>

<link href="http://nicolahibbert./demo/liteAccordion/css/liteaccordion.css" rel="stylesheet" />

Check out the full page demo here on Codepen.

var space = ($(window).width() - 100);
$('.column').width(space/4);

$(".column").click(function(){
	if (!$(this).hasClass('animated')) {
		$('.column').not($(this).parent()).dequeue().stop().animate({width: 'toggle', opacity: '0.75'},1750,'easeInOutQuint', function () {
      
    });
	}
  
  $(this).addClass('animated');
  	$('.column').not($(this,'.reveal').parent()).dequeue().stop().animate({width: 'toggle', opacity: '0.75'},1750,'easeInOutQuint', function () {
      
	  });
    $(this).dequeue().stop().animate({
        width:(space/4)
    },1400,'easeInOutQuint',function(){
      $(this).html('AGAIN');
    });
  $('.reveal').dequeue().stop().animate({
        width:'75vw'
    },1400,'easeInOutQuint',function(){
    });
});
body { overflow:hidden;max-width:100vw; }
header { position:absolute;left:0;top:0;width:200px;height:100vh;color:#ffffff;font-size:2em;}
.columns { position:absolute;left:100px;top:0;height:100vh;background:green;width:100%;}
.column { height:100vh;float:left;color:#ffffff;font-size:2em;text-align:center;display:block;opacity:0.75;-webkit-touch-callout: none;-webkit-user-select: none;-khtml-user-select: none;-moz-user-select: none;-ms-user-select: none;user-select: none;}
.reveal { background:rgba(0,0,0,0.5);height:100vh;-webkit-transition: all 2s;
    -moz-transition: all 2s;
    -o-transition: all 2s;
    transition: all 2s linear;left:200px;color:#ffffff; }
<div class="container">
  
  <header style="background:#333333;">
    
  </header>
  
  <div class="columns" style="background-image:url('http://placekitten./800/300');background-size:cover;background-repeat:no-repeat;background-position:center top;">
    
    <div class="column" style="background:blue;">DOUBLE<br>CLICK</div>
    <div class="column" style="background:green;">ANY<br>OF</div>
    <div class="column" style="background:orange;">THESE COLUMNS</div>
    <div class="column" style="background:pink;">TO REVEAL</div>
    <div class="column reveal">THIS</div>
  </div>
</div>

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745276918a4620096.html

相关推荐

  • javascript - make jquery ui accordion horizontal - Stack Overflow

    I am using jquery ui accordion to view different data to user, it's working perfectly as described

    3小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信