Now what we are going to do is stick your chosen widget to the top edge of the window as it is about to leave, thus making the widget visible at all time while the visitor scrolls. It will float there until its original location comes back when the page is scrolled back up.
This trick is applicable to any widget or element that has an ID, regardless of its location on your blog. It is perfect for a navigation bar, subscription box and social media sharing buttons.
See it in action, scroll down this post and keep your eyes on the top menu bar.
1. Press
2. Paste the following code above the </body> tag in your template or put it in a HTML/Javascript widget. If you choose to HTML/Javascript widget, make sure you position it below the widget that you want to make sticky.
3. Get the ID of the widget or element you want to make sticky and enter it in line 6 (replacing "YOUR_WIDGET_ID"). For example let's say the widget ID is HTML9, then code line 6 would become:
bs_makeSticky("HTML9");
4. Preview before saving.
Styling for the sticky widget while it's sticking can be applied in line 28.
Background and box-shadow are optional. However you might want to keep the background (and replace the color to match your sidebar's). Most templates do not assign a background to widgets meaning you can see the content scrolling in the background.
Enjoy!
You Also Like: Add Metro Style Social Sharing Button's For Blogger Blogs
0 comments:
Post a Comment