Creating a headline rotator

I was recently reading the book Learning Jquery by Jonathan Chaffer and Karl Swedberg . After reading the chapter on Rotators and Shufflers, which shows how you can create a headline rotator, I decided to implement one for my own website, adevelopedworld.com. adevelopedworld.com is a website which features social entrepreneurs from all around the world. We constantly get updates from the social entrepreneurs that we have featured, and we had to manually update the homepage to show these updates. After implementing the headline rotator, we just keep adding the updates to a text file, and the homepage gets automatically updated. And to top it, the homepage looks all the more dynamic.

The tutorial on how to create the rotator in the book is very complete. I just had to make one change. The tutorial is based on an old version of jQuery which supported XPath expressions. XPath expressions are no longer a part of JQuery. But there are two solutions :
a). Either add the XPath plugin for jQuery, OR
b). Change the XPath expression to a normal jQuery selector expression.

I used the latter.

A live demo of the headline rotator can be found at adevelopedworld.com.

Bookmark and Share

2 Comments »

  1. Porter Said,

    January 13, 2009 @ 9:56 am

    Do you mind sharing the code you wrote to convert XPath to a jQuery selector?

    This would be really powerful to help out with hpricot parsing of documents and then passing to the client which node (haystack) a needle was found in!

  2. balpreetspankaj Said,

    January 16, 2009 @ 12:16 pm

    Hey Porter,

    I did not write a generic code which would take in an XPATH expression and convert it to a jQuery selector expression.

    I just adapted the code to use jQuery selector expressions instead of XPATH expressions.

    Btw, I did not get what you are exactly trying to do after hpricot parsing ?

Leave a Comment