Tip: Create a marquee to scroll text
February 28th, 2008 | Published in Google Desktop API
Sometimes you might have more text than your gadget can display. Making that text scroll in a marquee is a great alternative to increasing the gadget's area.
The first step is to initialize a label with the text to display. You may want to add some filler text at the end to visually indicate the end of the message.
marqueeLabel.innerText = 'DEWEY DEFEATS TRUMAN; Boyle Leads in City. ';Then set up a timer that calls a function to shift the text:
function shiftText(label) {You can stop the marquee with this code:
label.innerText = label.innerText.substring(1) + label.innerText.charAt(0);
}
var marqueeint = view.setInterval(
'shiftText(marqueeLabel);',
200);
view.clearInterval(marqueeint);Have a tip you'd like to share? Send it to gd-developer AT google DOT com.