On 21/12/06, Jonathan Sharp <[EMAIL PROTECTED]> wrote:
> On 12/21/06, Sam Collett <[EMAIL PROTECTED]> wrote:
> > On 20/12/06, Jonathan Sharp <[EMAIL PROTECTED]> wrote:
> > > Another Proof of Concept code. I'll be refactoring this into a plugin in
> the
> > > next week or so.
> > >
> > > http://jdsharp.us/code/jdNewsScroll/
> > >
> > > Cheers,
> > > -js
> >
> > Not bad - only problem is items with two lines (second line gets cut
> > off). The only solutions to that may ruin the effect though.
> > Increasing the height to allow room for the second line would mean
> > extra whitespace when there is only one line used for a news item.
> > Dynamic resizing will impact the layout of a page.
> >
> > Perhaps I should improve my newsticker
> > (http://www.texotela.co.uk/code/jquery/newsticker/) to
> allow ajax and
> > different fx to be used. Mine just fades in rather than scrolls.
>
> That's cool, I hadn't seen that before.
>
> > What I want to know is how to do a typewriter effect ( i.e. type from
> > right to left single letters until the entire text is written).
> >
>
> I don't this this would be that hard to do apart from when complex markup is
> used within a string. For example if you have "Hello [World]" with "World"
> being a link. What are your thoughts?
>
> Cheers,
> -js
It would involve dom traversing the old fashioned way (i.e not using
jQuery), looping through childNodes. pseudo code:
var original = this;
var copy = original.cloneNode(true);
ticker(copy);
function ticker(node) {
var nodeCount = node.childNodes.length;
for(i = 0; i<nodeCount; i++) {
// if an element
if(node.childNodes[i].nodeType = 1) {
original.appendChild(node.childNodes[i]);
ticker(node.childNodes[i]);
}
for(// loop through characters) {
setTimeout(function() { original.parentNode.appendChild(char) }, 500);
}
}
}
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/