Most big blogs have sticky widget that scroll along when visitors move
up and down. The effect is usually applied to navigation menu or
subscription box, but what kept most people thinking is how they can add
the effect to their blog widget. Does that sound like you?
This effect will make a widget float downward when visitors scroll down and stay on its original position when visitors scroll up and reach the widget position. The trick is applicable to any widget so far it has a unique ID, regardless of its location, be it top, bottom or sidebar.
The effect is added to the first navigation menu on the demo page.
How To Add It Blogger
- Go to Template > Edit HTML
- Use ctrl F to find </body> and paste the following code above it.
<script>
// Sticky Widget By RealcomBiz.com
//<![CDATA[
rb_makeSticky("WIDGET ID HERE"); // enter your widget ID here
function rb_makeSticky(elem) {
var rb_sticky = document.getElementById(elem);
var scrollee = document.createElement("div");
rb_sticky.parentNode.insertBefore(scrollee, rb_sticky);
var width = rb_sticky.offsetWidth;
var iniClass = rb_sticky.className + ' rb_sticky';
window.addEventListener('scroll', rb_sticking, false);
function rb_sticking() {
var rect = scrollee.getBoundingClientRect();
if (rect.top < 0) {
rb_sticky.className = iniClass + ' rb_sticking';
rb_sticky.style.width = width + "px";
} else {
rb_sticky.className = iniClass;
}
}
}
//]]>
</script>
<style>
.rb_sticking {background:#f2f2f2 !important; position:fixed; top:0; z-index:9999; box-shadow:0px 10px 4px -5px rgba(0,0,0,0.3);}
</style>
// Sticky Widget By RealcomBiz.com
//<![CDATA[
rb_makeSticky("WIDGET ID HERE"); // enter your widget ID here
function rb_makeSticky(elem) {
var rb_sticky = document.getElementById(elem);
var scrollee = document.createElement("div");
rb_sticky.parentNode.insertBefore(scrollee, rb_sticky);
var width = rb_sticky.offsetWidth;
var iniClass = rb_sticky.className + ' rb_sticky';
window.addEventListener('scroll', rb_sticking, false);
function rb_sticking() {
var rect = scrollee.getBoundingClientRect();
if (rect.top < 0) {
rb_sticky.className = iniClass + ' rb_sticking';
rb_sticky.style.width = width + "px";
} else {
rb_sticky.className = iniClass;
}
}
}
//]]>
</script>
<style>
.rb_sticking {background:#f2f2f2 !important; position:fixed; top:0; z-index:9999; box-shadow:0px 10px 4px -5px rgba(0,0,0,0.3);}
</style>
- Replace WIDGET ID HERE with your widget unique ID.
How To Get Widget ID
- Visit any page on your blog, but make sure you have already log-in into your dashboard
- Right click on the edit icon (wrench icon) below the widget you want to apply the trick to.
- Select Copy Link Location and paste it into a notepad.
- You should be having something similar to the code below
http://www.blogger.com/rearrange?blogID=****************&widgetType=HTML&widgetId=HTML**&action=editWidget§ionId=crosscol
- Copy the widget ID after the line &widgetId= and place it in the line specified above.
If you have any queries or suggestions, feel free to drop it in the comment.
Subscribe For Free Updates!
*Please confirm the email sent to your inbox after clicking "Sign Up!".
Very Nice tutorials, will soon apply this method on My Blog.
ReplyDeletewow, nice code, i am going to float my menu bar for forever on my blog Intelligent Computing.
ReplyDeleteHaha, forever? Seems you fell so much in love with this hack? Anyway great approach!
DeleteWorking .. Thanks.. looking for it since months..
ReplyDeleteMany thanks to you. You're real combo. Other tutorial script does not work, but yours is magic! :D
ReplyDeletereal combo? WOW am butter up! Thanks for the compliment :)
DeleteThank you SO MUCH - I've been searching for a not-too-complicated way to do this!!
ReplyDeleteYou are welcome dear! Thanks for showing much interest. It will be a great pleasure if you suggest us to your friends :-)
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDeletethanks but can i installed on my blog TechEthix ?? reply fast I'm waiting :)
ReplyDeleteSure Rohit. You can apply it to any widget on your blog.
DeleteHi, I want my menubar skicy but i can not its "ID" How cam i get it. plz help..
ReplyDeleteBrother, I have a blog" www.saqisoft.blogspot.com" with 28 links. but i cannot have huge treffic how i can get visitors. plz help me.
ReplyDeleteThank you for posting such a useful, impressive.your blog is so beautiful. you have give me great news.
ReplyDeleteWebsite Development Company Bangalore
Nice post.....!!!!
ReplyDeleteFree Trial
Seriousaly I realy appreciate from your blog posting and design.I suggest to all, you should watch daily this blog. Thanks for share with us.
ReplyDeletefree commodity tips
This comment has been removed by a blog administrator.
ReplyDeleteI am very much pleased with the contents you have mentioned I wanted to thank you for this great post.
ReplyDeleteFree Trial
Stock Cash Tips
This comment has been removed by a blog administrator.
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDeleteVery impressive and well written blog on market guiding the investors with important information. Many of the investor will be happy to read your blog and earn huge profits in there investment.
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDeleteAwesome tutorial! But could you help me with something? How do i get rid of the gap between the widget and the top of the page? Thank you!
ReplyDeleteCheck under the CSS style. Replace top:0; with a negative value like top:-10px;
ReplyDeleteAwesome i just apply it on my ads unit here
ReplyDeletehttp://badhanpbn.blogspot.com
This comment has been removed by the author.
ReplyDeleteI always read college essay review services free. Yes, these websites are completely free, which is awesome for sure!
ReplyDeleteVeterans Day 2016
ReplyDeleteThank You Veterans Day Quotes
Raees 2nd Day Collection
Pumpkin Carving Patterns 2016
ReplyDeleteFunny Halloween 2016 Quotes
Pumpkin Carving Ideas with Pictures
Pumpkin Carvings Printable Stencils
Scary Pumpkin Faces Patterns
Wow thanks it really help see it here http://www.secretgist.com/
ReplyDeleteThis effect will make a widget float downward when visitors scroll down and stay on its original position when visitors scroll up and reach the widget position. The trick is applicable to any widget so far it has a unique ID, regardless of its location, be it top, bottom or sidebar. traditional afghan hat , antique choker designs , chain stitch patches , Velvet Punjabi Kurti
ReplyDelete