B
barry
I'm having a problem creating a delay before each list item gets moved
( http://www.polisource.com/PublicMisc/list-splitter-timeout-bug.html
). Choose any number of columns, vertical layout, and view as a web
page. They'll be a small delay before the entire bunch of list items
converts from left-to-right to top-to-bottom order. I expected a delay
before each item is moved. It looks like I have to flush the buffer to
get setTimeout to work, but I don't think there's a built-in flush
function in Javascript anymore. Or else setTimeout only delays the
function it calls the first time it's called and subsequently calls the
function with no delay. In this script I have:
setTimeout("funtest(" + li_count + "," + pos_change_left + "," +
pos_change_top + ")",700);
which calls:
function funtest(aaa,bbb,ccc)
{
var li = $('mylist').getElementsByTagName('LI');
li[aaa].style.position = 'relative';
li[aaa].style.left = bbb + 'px';
li[aaa].style.top = ccc + 'px';
}
once for each li that's moved (20 of them), but there's only one delay,
then they're all moved. If I put an alert in the function, it's
triggered 20 times, once before every change in position of a li, so
why aren't there 20 delays (one before each move) instead of just one?
( http://www.polisource.com/PublicMisc/list-splitter-timeout-bug.html
). Choose any number of columns, vertical layout, and view as a web
page. They'll be a small delay before the entire bunch of list items
converts from left-to-right to top-to-bottom order. I expected a delay
before each item is moved. It looks like I have to flush the buffer to
get setTimeout to work, but I don't think there's a built-in flush
function in Javascript anymore. Or else setTimeout only delays the
function it calls the first time it's called and subsequently calls the
function with no delay. In this script I have:
setTimeout("funtest(" + li_count + "," + pos_change_left + "," +
pos_change_top + ")",700);
which calls:
function funtest(aaa,bbb,ccc)
{
var li = $('mylist').getElementsByTagName('LI');
li[aaa].style.position = 'relative';
li[aaa].style.left = bbb + 'px';
li[aaa].style.top = ccc + 'px';
}
once for each li that's moved (20 of them), but there's only one delay,
then they're all moved. If I put an alert in the function, it's
triggered 20 times, once before every change in position of a li, so
why aren't there 20 delays (one before each move) instead of just one?