Thomas Leigh Diary

...thoughts on spiritual / personal development • software • books • and others...

Blogger: fix Popular Posts' thumbnails behavior

Notes:

    Blogger: fix Popular Posts' thumbnails behaviorOne of the most common Blogger gadget is called "Popular Posts". It displays a list of most frequently viewed posts of Your blog (which is pretty nice indicator of what Your Readers find most valuable).

    If You use the "Popular Posts" gadget with thumbnails enabled, You might have noticed the different behavior between thumbnails and posts' titles - when clicked. Titles are opening normally, while thumbnails are opening in a new window. Apparently there is no apparent reason why it works that way - it seems like this is a matter of how this gadget has been constructed. It may be confusing and/or totally unwanted for Your popular posts to be opened in new windows - fortunately You can fix it by a simple jQuery command.

    First of all, if You don't implement jQuery on Your site, here You'll find a short instruction how to do this. Having jQuery already implemented let's begin the actual fix:

    1. In the "Layout" section find "HTML/JavaScript" gadget You've created for the jQuery purpose. The easiest way is to use the same gadget for all jQuery instructions. Click the "Edit" link attached to this gadget.
    2. At the end of its content (which may already exists in the "Content" field) paste following code:

      /* Popular Posts' thumbnails fix */
      $('.popular-posts li a').removeAttr( "target" );

    3. Click "Save" button, refresh Your site and check if the thumbnails work properly now.

    No comments:

    Post a Comment