Phone : +1 710 558 8877

Make Normal Blogger Widgets Sticky In Blogger That Scrolls With Page

Image and video hosting by TinyPic
Sticky widgets are very popular these days. Most of the websites or blogs use sticky bars, menus, subscription boxes or even sticky header. Creating a sticky widget is very easy process. It can be done with help of a small script. In this post we will discuss about converting any normal widget in your blogger blog into a stylish sticky widget.

What is a sticky widget ?

A sticky widget is a normal widget which sticks to the top or bottom of the screen when we scroll the webpage up or down and remains there. When we move the webpage to the original location then this widget will automatically placed on its initial position.

Create any widget sticky in blogger blog:

Step 1: Login to your blogger dashboard.

Step 2: Select your blog.

Step 3: Select Template option and click on Edit HTML option.

Step 4: In the Template code find </head>

Step 5: Paste following code just above it and save the template.


Note: – In the following code replace wchnav1 with your own widget ID

Code:

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(function() {
    var wc_widget_top = $('#wchnav1').offset().top;
    var wc_sticky_widgets = function(){
        var wc_current_top = $(window).scrollTop();
           
        if (wc_current_top > wc_widget_top) {
          $('#wchnav1').css({ 'position': 'fixed', 'top':0, 'z-index':999999 });
        } else {
            $('#wchnav1').css({ 'position': 'relative' });
        }  
    };
    wc_sticky_widgets();
      $(window).scroll(function() {
         wc_sticky_widgets();
    });
});</script>

How to find widget ID ?

Step 1: Login to your blogger dashboard and select your blog.

Step 2: Select Template option and Click on Edit HTML option.

Step 3: In the template editor window click on Jump to widget option and select the required widget you want to make sticky.

Step 4: It will automatically leads cursor to the required widget code. Now you can find your widget ID in that code for example HTML1, Blog1, HTML2 etc.
Share it on

4 comments:

  1. Hello! Thank you so much for the code! So helpful — it’s one of the only ones that has worked for me.
    I just had a question… my navbar is under my header & as soon as I scroll down, the navbar immediately sticks to the top. I love how your blog waits until you actually scroll past the navbar before it sticks to the top (I hope that made sense). Is there something I can tweak / add to the code so that occurs on my blog too?
    Thank you in advance! (:

    ReplyDelete
    Replies
    1. Thanks for commenting.
      It’s mostly to do with how fast your blog loads, you can alter the padding-top'value in the script depending on how big your header is.

      Delete
    2. Thanks Abdullah!
      You make a personal and evocative conversationb with your reader,keep it up.

      Delete
    3. Thanks for reaching us buddy,Its my pleasure.

      Delete

Dear Reader! We’re enthusiastic to see your comment but after reading the Content please ask for advice and to provide constructive feedback Please Write Relevant Comment with Polite Language.Your comments inspired me to continue blogging. Your opinion much more valuable to me.
Let’s enjoy a personal and evocative conversation. Thank You!

Tweet to Founder

DO YOU WANT TO BE #1 ON GOOGLE?

- CHECKOUT OUR BEGINNERS GUIDE TO SEO! ITS FREE -

Contact Form

Name

Email *

Message *