cialis online pharmacy generic xenical cheap cialis online cialis generic viagra online in canada buy cheap levitra online cialis without a perscription order viagra uk no prescription flagyl cheap generic levitra buying viagra in the uk cheap viagra approved cialis deltasone online buy viagra online without prescription non prescription cialis buy orlistat uk buy cialis in india prednisone 60 mg female viagra online buy viagra without prescription celebrex prescriptions buy cialis canada best prices viagra alternative to prednisone cheapest generic levitra levitra 5mg cheap viagra cialis on line buy xenical without prescription online accutane canadian health care prednisone no prescreption viagra online generic female viagra europe buy cialis low price cheap india viagra

Animate Your News Feed With CSS And jQuery

Providing a web or news feed to your site visitors is always considered as good practice when running a web site. It’s the best way to keep them informed of any updates to your content. But wouldn’t it be nice to spruce things up a little by giving your audience a fun and unique experience every time they check out your feed?

Fortunately for us, a web service and API developer named Motyar was nice enough to share his idea to the rest of the web design community through an easy tutorial.

This tutorial was inspired by FourSquare’s animated updates feed ticker. In order to mimic the effect, we’re going to use a combination of CSS and jQuery. And don’t worry; it’ll only be a short one, but knowledge in both programming languages and WordPress does help.

You can check out the DEMO be sure to back up your files beforehand.

We’ll start off with the basic HTML markup:

<div id="feeds">
<div id="feed0" style="display: none;">YOURCONTENTS</div>
<div id="feed1" style="display: none;">YOURCONTENTS</div>
<div id="feed2" style="display: none;">YOURCONTENTS</div>
</div>

We then apply a bit of CSS to take care of appearance though feel free to tweak the code to suit your preferences.

#feeds{
width:1000px;
margin-left:200px;
margin-right:auto;
margin-top:40px;
border-top:#333 dashed 1px;
}
.item{
margin:0;
width:980px;
height:80px;
font-size:30px;
border-bottom:#333 dashed 1px;
padding:0px 10px 0px 10px;
}

Finally, to add the animated effect, copy/paste this jQuery.

var delay = 2000; // you can change it
var count = 5; // How much items to animate
var showing = 3; //How much items to show at a time
var i = 0;
function move(i) {
return function() {
$('#feed'+i).remove().css('display', 'none').prependTo('#feeds');
}
}
function shift() {
var toShow = (i + showing) % count;
$('#feed'+toShow).slideDown(1000, move(i));
$('#feed'+i).slideUp(1000, move(i));
i = (i + 1) % count;
setTimeout('shift()', delay);
}
$(document).ready(function() {
setTimeout('shift()', delay);
});

Save and check to see the result, and that’s it! If you have any questions or comments, you can get in touch with Motyar through Google Plus.

Related Posts

How to Create a Custom WordPress Registration Form with Flat UI

10 Great jQuery Plugins for November 2013

Halloween Free HTML5 Theme

Create Google Play’s Tab Navigation Using jQuery And CSS

1 Comment

  1. Paul

    09.06.2012

    Thanks for the awesome script. I tried implementing in my website – one thing I found is when I set the ‘var delay = 6000;’ the feed area is blank (empty) for 6 seconds and then starts to load the news. Can you please let me know if I can have the news starts as soon as the website loads and not having to wait 6 seconds. Thanks.