Skip to main content

Smooth and versatile horizontal accordion jQuery script

jQuery_accordion_horizontal Turn an ordinary UL list into a smooth, versatile, and appealing accordion. This is good for showing off new products or featured contents from your site so readers don’t have to dig around for it. LI lists expands sideways on mouse over while contracting its peers. The HTML markup of the accordion can either be defined inline on the page or inside an external file instead. You can also specify which LI you want to have expanded by default and modify it’s appearance to fit your template.

 

view_tree_modernist Click here to see the demo

 

Directions


Step 1:
Under the Layout > Edit HTML tab - insert the following section code below right before the closing head tag – </head>

<link href='haccordion/haccordion.css' rel='stylesheet' type='text/css'/>
<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js' type='text/javascript'/>
<script src='haccordion.js' type='text/javascript'>

</script>

<style type='text/css'>

/*CSS for example Accordion #hc1*/

#hc1 li{
margin:0 3px 0 0; /*Spacing between each LI container*/
}

#hc1 li .hpanel{
padding: 5px; /*Padding inside each content*/
background: lightblue;
}

/*CSS for example Accordion #hc2*/

#hc2 li{
margin:0 0 0 0; /*Spacing between each LI container*/
border: 12px solid black;
}

#hc2 li .hpanel{
padding: 5px; /*Padding inside each content*/
background: #E2E9FF;
cursor: hand;
cursor: pointer;
}

</style>

<script type='text/javascript'>

haccordion.setup({
    accordionid: &#39;hc1&#39;, //main accordion div id
    paneldimensions: {peekw:&#39;50px&#39;, fullw:&#39;400px&#39;, h:&#39;158px&#39;},
    selectedli: [0, true], //[selectedli_index, persiststate_bool]
    collapsecurrent: false //
})

haccordion.setup({
    accordionid: &#39;hc2&#39;, //main accordion div id
    paneldimensions: {peekw:&#39;30px&#39;, fullw:&#39;450px&#39;, h:&#39;150px&#39;},
    selectedli: [-1, true], //[selectedli_index, persiststate_bool]
    collapsecurrent: true //
})

</script>

Note: The code above references 2 external .js files and an image, which you need to download below (right click/ select “Save As”)

 

Step 2: Navigate over to Layout > Page Elements to add an HTML/JavaScript gadget. Copy and paste the following section code below in the box and select save.

 

Demo 1 -

<h2>Demo 1:</h2>

<div id="hc1" class="haccordion">
    <ul>

    <li>
        <div class="hpanel">
        <img style="float:left; padding-right:8px; width:200px; height:148px" src="mail_receive.png"/>subscribe by email to blogspot vision to receive daily updates, free ebooks, and notice of upcoming contests
        </div>
    </li>

    <li>
        <div class="hpanel">
        <img style="float:left; padding-right:8px; width:200px; height:148px" src="facebook.png"/>connect with us on facebook for website updates and interact with other bloggers around the world 
        </div>
    </li>

    <li>
        <div class="hpanel">
        <img style="float:left; padding-right:8px; width:200px; height:148px" src="twitter.png"/>connect with us on twitter for bite sized updates and other promotions 
        </div>
    </li>

    </ul>
</div>

<p style="clear:left"><a href="javascript:haccordion.expandli('hc1', 0)">Expand 1 Panel</a> | <a href="javascript:haccordion.expandli('hc1', 1)">Expand 2nd Panel</a> | <a href="javascript:haccordion.expandli('hc1', 2)">Expand 3rd Panel</a> </p>

 

 

Demo 2 -

<h2>Demo 2:</h2>

<div id="hc2" class="haccordion">
    <ul>

    <li style="border-right-width:0">
        <div style="padding:10px; width:250px" class="hpanel">
        subscribe by email to blogspot vision to receive daily updates, free ebooks, and notice of upcoming contests
        </div>
    </li>

    <li style="border-right-width:0">
        <div style="padding:10px; width:180px" class="hpanel">
connect with us on twitter for bite sized updates and other promotions 
        </div>
    </li>

    <li style="border-right-width:0">
        <div style="padding:10px; width:350px" class="hpanel">
        connect with us on twitter for bite sized updates and other promotions
        </div>
    </li>

    </ul>
</div>

*Tutorial completed

Source: Dynamic Drive – dhtml scripts for the real world

Comments

  1. hey i tried it and it didn't work.. i tried it with the instructions directly from dynamic drive as well and what i'm having trouble with the part where we're suppose to save the .js documents, do we reupload those somewhere? (blogger doesn't let us directly import it) and in page elements it doesn't let you do an html gadget anymore ):

    please help ):

    ReplyDelete

Post a Comment

Popular posts from this blog

How to add a calendar icon as date header

From this tutorial, you will be able to add your very own calendar icon to your blogger! If you’re going to show the date on every post, why not do it with a little style and make it a little more appealing to viewers? If you want your calendar icon to appear on every post, read Blogspot Vision’s post on how to do that by clicking here to go to the post. Let’s get started but first and foremost, make sure you back-up your existing template, just in case it doesn’t turn out as expected. Steps to follow:1. Login to your Blogger dashboard2. Go to Layout > Edit HTML (Click on “expand widgets” box)3. Search for the following section code: ]]></b:skin>
and add the following section code below right before it:.post .date {
    height: 50px;
    width: 45px;
    background: url(http://www.blogspotvision.com/bspotvision/itheme-calendar.gif) no-repeat;
    font: normal 22px Arial;
    color: #666666;
    text-align: center;
    …

CSS DIV boxes with drop shadows

This example shows how to add a drop shadow style to any container element using CSS. It does this by wrapping the desired content in a DIV with its background color set to a color of the desired color for the shadow. Another DIV is set for your content and is shifted slightly upwards and to the left to expose the shadow. The "master" DIV wraps it all up but is shifted to the right and downwards, returning the entire markup to it's original page position.

IE6 is not compatible with this example, but you can apply conditional HTML to hide the effect in that browser. In contrast, IE7 is compatible with this example for finally updating to proper CSS.

Note: If you will be using an image for your content, you should give ".shadowcontainer" an explicit height, reflecting that of the image's for fixed and set location when viewed.



CSS Code
<![if !IE 6]>
.shiftcontainer{
position: relative;
left: 5px; /*Number should match -left shadow depth below*/
top: 5px;…

How To Show The Post Date On Every Post

From this tutorial, you will be able to show the post date on every last one of your posts. As we all know, Blogger’s default templates only show a single date for every post that was posted that day. Some readers will find it convenient to have that quick glance at the date on each post, but some will not even notice. This tutorial is definitely handy if you plan to use a calendar icon as your post date, since the timestamp can be modified. As always, make sure you download your current existing template just in case it doesn’t turn out as expected.

Steps to follow:
1.Login to your Blogger dashboard.
2. Go to Layout > Edit HTML (click on “expand widgets” box)
3. Now search for the red line of code or similar code:Note: If you can’t seem to find the line in red, try the second section code in blue.<div class='post-feeds'>
<b:loop values='data:posts' var='post'>
<b:if cond='data:post.dateHeader'>
<h2 class='date-header'>
<da…