Re: Walter Zorn's wz_dragdrop
- From: RobG <rgqld@xxxxxxxxxxxx>
- Date: Wed, 22 Mar 2006 04:22:58 GMT
Joel Byrd said on 22/03/2006 1:58 PM AEST:
ADDENDUM: I've actually traced the problem to Opera's method of
rendering images. The problem is that the positions of the drop
targets are being calculated before the images are rendered, so that
once the images are loaded, the *actual* positions of the drop targets
change (are pushed down by the images) while their *calculated*
positions remain the same (and are, therefore, off). So I am using
setInterval with a function that includes all the code for calculating
the position of the drop targets - and this is in an if statement that
checks to see whether all the images on the page have been loaded. In
other words, none of the drop target position code executes until all
the images on the page have been rendered. But, alas, I have another
problem. Within this code is included the main wz_dragdrop method,
which is SET_HTML(). The way it works is that you pass the names or
id's of the elements that you want to make draggable (or droppable),
separating them by commas. But I want this list of elements to be
dynamic, so I can't just call SET_HTML(elem1, elem2, elem3). I have to
create a list (comma-separated string) and pass it into the function
using eval (yes, I'm using eval - so shoot me).
That doesn't justify using eval(). Why not keep the list of id's up to date in an array (say called idArray) and use:
SET_HTML( idArray.join(',') );
join usea a comma by default as the separator, the above just makes it explicit. You could probably safely use:
SET_HTML( idArray.join() );
You could also keep the ids in a string and concatenate them:
idString += ',' + someId;
but the array makes it easier to manage the separators and provides some other management tools that might come in handy - length in particular.
Apparently, eval is having trouble being called inside a function -
does anyone know anything about this problem?
See my reply to your other thread.
--
Rob
.
- Follow-Ups:
- Re: Walter Zorn's wz_dragdrop
- From: Joel Byrd
- Re: Walter Zorn's wz_dragdrop
- References:
- Re: Walter Zorn's wz_dragdrop
- From: Joel Byrd
- Re: Walter Zorn's wz_dragdrop
- Prev by Date: Re: Using eval() inside a function
- Next by Date: Re: Walter Zorn's wz_dragdrop
- Previous by thread: Re: Walter Zorn's wz_dragdrop
- Next by thread: Re: Walter Zorn's wz_dragdrop
- Index(es):
Relevant Pages
|