Posted by dalehgeist on June 24, 2009 at 7:17pm
| Project: | ticketyboo News Ticker |
| Version: | 6.x-1.3 |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs review |
Issue Summary
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.
Comments
#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.#5
meltingIce
what does dupCount mean ? I can't figure it out
another approach would be to implement this javascript
take the first element and put it to the end of the wrapper with something like this
when the ticket has passed
if (tick[delta].events == 0) {tick[delta].status = 'initpause';
tick[delta].item = tick[delta].item + 1;
$('#ticketyboo_1_wrapper div:first').remove().appendTo('#ticketyboo_1_wrapper'); //addition
but can't seem to get it to work correctly
#6
still not sure of the implecations of dupCount
hope meltingIce can clarify it
I am using dupCount = 1 and it seems to work as expected ...
otherwise is exactly what meltingIce has implemented
please apply against 1.3 version and report back
#7
needs review