Continuous scrolling, please
dalehgeist - June 24, 2009 - 19:17
| Project: | ticketyboo News Ticker |
| Version: | 6.x-1.3 |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Description
What I'm looking for is to have the first item scroll onto the screen after the last item has scrolled off - rather than the current behavior of popping onto the screen. (I'd suggest offering a "continuous" checkbox on the UI.)
I tried faking this with an offset equal to the width of the ticker, but the last item gets blown away by the first one as soon as it gets to the center of the ticker. (I'd be happy to hear a workaround.)
Other than that, it worked as advertised right out of the box - well done.

#1
+1 for this feature
#2
I'm a css and Drupal newbee but to suite my own need of a continous ticker I edited ticketyboo.module to simply duplicate nodes.
That way I get a continous scroll where last item is _immediately_ followed by first item.
While not exactly what you asked for, the method could possibly me modified by inserting empty tickers instead of duplicated ones.
Change 'dupCount' as needed, value depending on ticker size and space available.
$ diff -u ticketyboo.module.orig ticketyboo.module
--- ticketyboo.module.orig 2009-06-24 12:09:00.000000000 +0200
+++ ticketyboo.module 2009-06-27 08:52:21.000000000 +0200
@@ -220,12 +220,26 @@
$i++;
}
+ // continuous ticker by duplication of nodes
+ $dupCount = 4;
+ $count = $i;
+ if (($dupCount > 0) && ($count > 0)) {
+ for ($j = 0; $j < $dupCount; $j++) {
+ $node = node_load(trim($nodes[($j % $count)]));
+ $ret .= '';
+ $ret .= '';
+ $ret .= $node->teaser;
+ $ret .= '';
+ $i++;
+ }
+ }
+
// build a wrapper for the contents
if ($direction == 'horizontal') {
- $w = count($nodes) * ($item_width + $item_spacing);
+ $w = ($dupCount + count($nodes)) * ($item_width + $item_spacing);
$h = $item_height;
} else {
- $h = count($nodes) * ($item_height + $item_spacing);
+ $h = ($dupCount + count($nodes)) * ($item_height + $item_spacing);
$w = $item_width;
}
$wrap_style = "width: {$w}px; height: {$h}px;";
#3
oops. The diff above does not show correctly - empty quotes where div tags occur.
Uploading diff file instead.
#4
Thanks, Ice. Haven't tried it yet, as the client seems fine with the non-scrolling version, but it's good to know it's there. Here's a little something in return: you can use a
<code>tag to enclose code on this board, and it will show up just like you want it.