Friday, April 27, 2007

jQuery Plugin update: newsticker

I've updated my news ticker plugin to fix a few bugs. Also included on the page are some examples of adding content dynamically and applying it to the added content.

6 comments:

greg said...

Hi,

I really appreciate the clear instructions and have the ticker working, with the exception that the entire list appears for a second or two before the plugin 'takes hold.' This doesn't happen when I look at TexoTela, only my site, and even though I've looked at the page source and tried to make sure everything is the same, it still happens.

You address this when you write

"You may see all of the items in the ticker before the function is applied. You can get around this by adding the CSS above to the ticker container ..."

... but excuse my newbie question, do you mean adding the CSS to the ticker's CSS container? Or is there a container concept in Javascript I'm missing? I've spent about two hours trying to fix this, and am at a dead end!

thanks

greg said...

Hi,

I really appreciate the clear instructions and have the ticker working, with the exception that the entire list appears for a second or two before the plugin 'takes hold.' This doesn't happen when I look at TexoTela, only my site, and even though I've looked at the page source and tried to make sure everything is the same, it still happens.

You address this when you write

"You may see all of the items in the ticker before the function is applied. You can get around this by adding the CSS above to the ticker container ..."

... but excuse my newbie question, do you mean adding the CSS to the ticker's CSS container? Or is there a container concept in Javascript I'm missing? I've spent about two hours trying to fix this, and am at a dead end!

thanks

Sam said...

That's an old comment from a previous version that I forgot to take out (when the CSS was different).

This hopefully will work (not tested yet though):

-- HTML --
<ul id="news">
<li class="first">Visit <a href="http://news.bbc.co.uk">BBC News</a> for news from the British radio/TV broadcaster</li>
<li>Visit <a href="http://news.google.co.uk">Google News</a> for a variety of news from different sources across the web</li>
<li>Visit <a href="http://www.engadget.com/">engadget</a> for the latest in new gadgets</li>
<li>Visit the <a href="http://jquery.com/blog/">jQuery blog</a> for updates on jQuery</li>

</ul>


-- CSS --
#news {
list-style-type: none;
border: 1px dashed #fff;
background: #050c44;
padding: 3px;
margin: 0;
}

#news li {
display: none;
}

#news li.first {
display: list-item;
}

greg said...

That did it! Thanks!

Fred said...

This doesn't seem to work in IE7 but works fine on firefox. Any ideas?

Sam said...

It could be the extra ; near the end

Replace

};

})(jQuery);

with

}

})(jQuery);