mardi 19 novembre 2013

Recent Rotating Post Gadget with Excerpt For Blogger

This JavaScript code will display the latest posts of any feed, the difference being that it has two parts which can be used individually or combined. The top of this widget will show a single post along with the title (link), author, date and a brief summary of its content. In addition, this post will rotate automatically within a list whose number of elements will be decided by us. At the bottom, we'll find a full list with the chosen posts that on mouse over will replace the post above, thus breaking the automatic cycle.

Before installing anything, let's see it in action to decide if it does what we want.


recent posts widget for blogger

How to Add Recent Rotating Posts Widget to Blogger

Step 1. Go to Layout > click on Add a Gadget link.


Step 2. From the pop-up window, choose the HTML/JavaScript gadget


Step 3. Paste this code inside the empty box:



Loading...

Customizations:

The URL in blue is the feed. Obviously, the http://helplogger.blogspot.com URL should be replaced with the feed URL of your blog.

Next is start-index=1. This number indicates which post will appear first on the list. By default, it is the latest post published on your blog, so if you want to begin displaying older posts, change the 1 value.

max-results=10 indicates the maximum number of posts that we will be reading from the feed, beginning from the one that we have set up before in the start-index=1. This number always needs to be equal or greater to what we should see later and what it does is to set the number of posts that will be shown in the gadget. The easiest way would be to put 500 in order not to fail, but the higher the number is, the longer the gadget will take to load, so it's better to adjust to what we need to show.

Finally, here are some other script parameters:

title: 'Latest Posts', is the widget's title that appears on top.
numResults: 10, number of posts that will show in the list
displayTime: 5000, the delay time between posts in the rotator (in milliseconds)
hoverTime: 500, minimum time for an item in the list to be displayed at the top.

If you want to hide the list and show only the posts, change this part:
.gfg-list {
position : relative;
overflow : hidden;
text-align : left;
}
To:
.gfg-list {
display:none;
}
If you want to display only the list, change this:
.gfg-entry {
background-color: #FFFFFF;
width : 100%;
height : 9.2em;
position : relative;
overflow : hidden;
text-align : left;
margin-top : 3px;
}
To:
.gfg-entry {
display: none; }

Step 4. Save the gadget and you're done. Enjoy!

Libellés : , ,

0 commentaires:

Enregistrer un commentaire

Abonnement Publier les commentaires [Atom]

<< Accueil