When I was browsing a design blog called "impressivewebs", I found a header that could collapse itself. Impressed by the effect, I sat down to work out the logic and it was pretty simple to achieve it on blogger. In this article, I'll illustrate the collapsible effect with simple message panels while you may apply the same logic to your header or post area or to any widget of your choice.
COLLAPSIBLE MESSAGE PANELS ON BLOGGER - LIVE DEMO
So, take a look at the live demo by hitting the link above. I guess you liked it... Interested to add this on your blog, as well? Then, follow the steps below.
1. Navigate to "Design>>Edit HTML" and make a backup of your template by clicking on the "Download full template" link at the top of the page. Once the back up is over, search for the following piece of code.
Note: I've used an image for the title part of the image. You may replace the same with gradient colors using CSS. Refer the following article to do the same - Cross-Browser Gradient Effect Using CSS.
3. Next, search for the following piece of code.
Note: Do not include the first line in the script mentioned above if you've already added the latest jquery file on your blog.
5. Now, paste the following piece of code in the document - HTML FOR COLLAPSIBLE EFFECT, anywhere inbetween your <body> and </body> tags - probably within the post editor (or) below <div class='main-wrapper'> (or) <div class='columns fauxcolumns'>.
6. That's it! Save your template or publish the article and view the same to enjoy the effect.
HTML CUSTOMIZATION - FOR CODE MENTIONED IN STEP 5
If you wish to generate the time for your messages (displayed at the top right) by default, then change the text that appears in between <span class="timestamp"> and </span> tags. Similarly, you can change the text from "NAME" and "CLIENT" with your names and clients respectively. I've added my name and a small message in the first few div tags for reference. Check the same (code mentioned in text document at step 5) for your reference.
I've tested the above effect on all the major browsers which includes, but not limited to, IE, FF, Chrome, Safari and Opera. Let me know if you find some bugs with the above coding. If you need assistance in extending this effect to other elements on your blog, then leave a comment below and I'll help you out when I'm free:) Do share your opinions about the article via comments!
1. Navigate to "Design>>Edit HTML" and make a backup of your template by clicking on the "Download full template" link at the top of the page. Once the back up is over, search for the following piece of code.
]]></b:skin>
2. Just paste the following piece of code above the line mentioned at step 1..message_list {
list-style: none;
margin: 0;
padding: 0;
width: 383px;
}
.message_list li {
padding: 0;
margin: 0;
background: url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjWSiLK7l2NazLVhKXgLHgeHNrHruSmDh04FLTY0sznAmCbw1kLblruqtP-JvZlixX0v9zXt_BaQz1pL39ydKI0q3KyftuGaOddPAGgv3p-EyrlHtBkZQAcBd6ZRG01mMPaFyyOkn963LWj/s800/message-bar.png) no-repeat;
}
.message_head {
padding: 5px 10px;
cursor: pointer;
position: relative;
}
.message_head .timestamp {
color: #666666;
font-size: 95%;
position: absolute;
right: 10px;
top: 5px;
}
.message_head cite {
font-size: 100%;
font-weight: bold;
font-style: normal;
}
.message_body {
padding: 5px 10px 15px;
}
.collapse_buttons {
text-align: right;
border-top: solid 1px #e4e4e4;
padding: 5px 0;
width: 383px;
}
.collapse_buttons a {
margin-left: 15px;
float: right;
}
.show_all_message {
background: url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJrd_F3LSpO_LY5FBT4B8va0UUl45rH5w6LIaEOw1HFGWeU09nWF33naWG7R2hSbIclXit1IutinwEtb4RqbGQ1RD8VfnjY3pb_s_dLee1FRyCwld3oh0oDIB0Psk7kT8yOaPgfSWhtf8q/s800/tall-down-arrow.png) no-repeat right center;
padding-right: 12px;
}
.show_recent_only {
display: none;
background: url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjZZjQIx9NzlPrJg-bKSLjOhjZUfB2LF5DFaQDXTzZW890Qyzzl_WG1MOCEgRxvgCH4izFkrQ0l9ZYcdcp25deHgsDMLV21GzzjdF-zvf8WnonER5On90yOTEbMlqwb7XfIazp3ASJf2XIz/s800/tall-up-arrow.png) no-repeat right center;
padding-right: 12px;
}
.collpase_all_message {
background: url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi5SMPx00QZ67Vp89VuV1Vwxq0nmjYNW8H1KhPT3nAVkfiuYQ4OsGYVSj1OeTX8_FkM6jUv-bz0AepdlFT40BfKI1cqx6M6dy9oHRVzP7DqExM_Szvs9DoUYMK1vefnaHJPI-vV9avwlWei/s800/collapse-all.png) no-repeat right center;
padding-right: 12px;
color: #666666;
}
list-style: none;
margin: 0;
padding: 0;
width: 383px;
}
.message_list li {
padding: 0;
margin: 0;
background: url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjWSiLK7l2NazLVhKXgLHgeHNrHruSmDh04FLTY0sznAmCbw1kLblruqtP-JvZlixX0v9zXt_BaQz1pL39ydKI0q3KyftuGaOddPAGgv3p-EyrlHtBkZQAcBd6ZRG01mMPaFyyOkn963LWj/s800/message-bar.png) no-repeat;
}
.message_head {
padding: 5px 10px;
cursor: pointer;
position: relative;
}
.message_head .timestamp {
color: #666666;
font-size: 95%;
position: absolute;
right: 10px;
top: 5px;
}
.message_head cite {
font-size: 100%;
font-weight: bold;
font-style: normal;
}
.message_body {
padding: 5px 10px 15px;
}
.collapse_buttons {
text-align: right;
border-top: solid 1px #e4e4e4;
padding: 5px 0;
width: 383px;
}
.collapse_buttons a {
margin-left: 15px;
float: right;
}
.show_all_message {
background: url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJrd_F3LSpO_LY5FBT4B8va0UUl45rH5w6LIaEOw1HFGWeU09nWF33naWG7R2hSbIclXit1IutinwEtb4RqbGQ1RD8VfnjY3pb_s_dLee1FRyCwld3oh0oDIB0Psk7kT8yOaPgfSWhtf8q/s800/tall-down-arrow.png) no-repeat right center;
padding-right: 12px;
}
.show_recent_only {
display: none;
background: url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjZZjQIx9NzlPrJg-bKSLjOhjZUfB2LF5DFaQDXTzZW890Qyzzl_WG1MOCEgRxvgCH4izFkrQ0l9ZYcdcp25deHgsDMLV21GzzjdF-zvf8WnonER5On90yOTEbMlqwb7XfIazp3ASJf2XIz/s800/tall-up-arrow.png) no-repeat right center;
padding-right: 12px;
}
.collpase_all_message {
background: url(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi5SMPx00QZ67Vp89VuV1Vwxq0nmjYNW8H1KhPT3nAVkfiuYQ4OsGYVSj1OeTX8_FkM6jUv-bz0AepdlFT40BfKI1cqx6M6dy9oHRVzP7DqExM_Szvs9DoUYMK1vefnaHJPI-vV9avwlWei/s800/collapse-all.png) no-repeat right center;
padding-right: 12px;
color: #666666;
}
3. Next, search for the following piece of code.
</head>
4. Paste the following piece of code just above the line mentioned in step 3. Save your template.<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js' type='text/javascript'/>
<script type='text/javascript'>
$(document).ready(function(){
//hide message_body after the first one
$(".message_list .message_body:gt(0)").hide();
//hide message li after the 5th
$(".message_list li:gt(4)").hide();
//toggle message_body
$(".message_head").click(function(){
$(this).next(".message_body").slideToggle(500)
return false;
});
//collapse all messages
$(".collpase_all_message").click(function(){
$(".message_body").slideUp(500)
return false;
});
//show all messages
$(".show_all_message").click(function(){
$(this).hide()
$(".show_recent_only").show()
$(".message_list li:gt(4)").slideDown()
return false;
});
//show recent messages only
$(".show_recent_only").click(function(){
$(this).hide()
$(".show_all_message").show()
$(".message_list li:gt(4)").slideUp()
return false;
});
});
</script>
<script type='text/javascript'>
$(document).ready(function(){
//hide message_body after the first one
$(".message_list .message_body:gt(0)").hide();
//hide message li after the 5th
$(".message_list li:gt(4)").hide();
//toggle message_body
$(".message_head").click(function(){
$(this).next(".message_body").slideToggle(500)
return false;
});
//collapse all messages
$(".collpase_all_message").click(function(){
$(".message_body").slideUp(500)
return false;
});
//show all messages
$(".show_all_message").click(function(){
$(this).hide()
$(".show_recent_only").show()
$(".message_list li:gt(4)").slideDown()
return false;
});
//show recent messages only
$(".show_recent_only").click(function(){
$(this).hide()
$(".show_all_message").show()
$(".message_list li:gt(4)").slideUp()
return false;
});
});
</script>
5. Now, paste the following piece of code in the document - HTML FOR COLLAPSIBLE EFFECT, anywhere inbetween your <body> and </body> tags - probably within the post editor (or) below <div class='main-wrapper'> (or) <div class='columns fauxcolumns'>.
6. That's it! Save your template or publish the article and view the same to enjoy the effect.
HTML CUSTOMIZATION - FOR CODE MENTIONED IN STEP 5
If you wish to generate the time for your messages (displayed at the top right) by default, then change the text that appears in between <span class="timestamp"> and </span> tags. Similarly, you can change the text from "NAME" and "CLIENT" with your names and clients respectively. I've added my name and a small message in the first few div tags for reference. Check the same (code mentioned in text document at step 5) for your reference.
I've tested the above effect on all the major browsers which includes, but not limited to, IE, FF, Chrome, Safari and Opera. Let me know if you find some bugs with the above coding. If you need assistance in extending this effect to other elements on your blog, then leave a comment below and I'll help you out when I'm free:) Do share your opinions about the article via comments!