HighDots Forums  

Re: Select elements on webpage in same way as with the explorer

JavaScript discussion (multi-lingual) JavaScript discussion (alt.comp.lang.javascript)


Discuss Re: Select elements on webpage in same way as with the explorer in the JavaScript discussion (multi-lingual) forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
impaler
 
Posts: n/a

Default Re: Select elements on webpage in same way as with the explorer - 01-06-2006 , 05:43 AM






Here is a very good link for drag&drop

http://www.walterzorn.com/dragdrop/dragdrop_e.htm

It has the Resize Instead of Drag feature that lets you use the SHIFT
key and is doing resize instead of move.

Yes it's possible to mark a section, remember the beginning of the drag
and the finish of it, loop through the images and calculate which are
inside the rectangle and mark them selected.

These are guidelines
For insight take a look into the libraries and I'm sure you'll find
interesting code in there.

Regards


Reply With Quote
  #2  
Old   
Ask Josephsen
 
Posts: n/a

Default Re: Select elements on webpage in same way as with the explorer - 01-06-2006 , 06:36 AM






That is an awsome library.

How do I calculate which images is within the selected area? must I
specifically place the images like this: "#imgA {position:absolute; left:
10; top: 10; width:120px; height:100px; z-index:0}". That's not really cool
for a dynamically generated list of images...


Venlig hilsen

Ask Josephsen


web: www.minreklame.dk
"impaler" <TamasJano (AT) gmail (DOT) com> skrev i en meddelelse
news:1136547783.502184.22220 (AT) f14g2000cwb (DOT) googlegroups.com...
Quote:
Here is a very good link for drag&drop

http://www.walterzorn.com/dragdrop/dragdrop_e.htm

It has the Resize Instead of Drag feature that lets you use the SHIFT
key and is doing resize instead of move.

Yes it's possible to mark a section, remember the beginning of the drag
and the finish of it, loop through the images and calculate which are
inside the rectangle and mark them selected.

These are guidelines
For insight take a look into the libraries and I'm sure you'll find
interesting code in there.

Regards




Reply With Quote
  #3  
Old   
TamasJano@gmail.com
 
Posts: n/a

Default Re: Select elements on webpage in same way as with the explorer - 01-06-2006 , 08:05 AM



Loop through your images, get their position and determine if they fall
into the selected area.
Make use of the offsetTop and offsetLeft properties of the image but
beware that it will give you the offset of their respective parents so
you have to do a recursive calculation but it depends on how you design
your layout.
Another good link that offers you a solution would be:
http://www.quirksmode.org/js/findpos.html

You simply calculate:

if (findPosX(img) >= dragStartX && findPosY(img) >= dragStartY) {
//it's selected }

you can do additional check to be inside completly the selected area.
The variables are self explanatory.

A good idea is to implement some kind of a grid layout to bring some
order into the chaos, to have some rules for displaying images.


Regards


Reply With Quote
  #4  
Old   
TamasJano@gmail.com
 
Posts: n/a

Default Re: Select elements on webpage in same way as with the explorer - 01-06-2006 , 08:19 AM



Loop through your images, get their position and determine if they fall
into the selected area.
Make use of the offsetTop and offsetLeft properties of the image but
beware that it will give you the offset of their respective parents so
you have to do a recursive calculation but it depends on how you design
your layout.
Another good link that offers you a solution would be:


You simply calculate:

if (findPosX(img) >= dragStartX && findPosY(img) >= dragStartY) {
//it's selected }

you can do additional check to be inside completly the selected area.
The variables are self explanatory.

A good idea is to implement some kind of a grid layout to bring some
order into the chaos, to have some rules for displaying images.


Regards


Reply With Quote
  #5  
Old   
TamasJano@gmail.com
 
Posts: n/a

Default Re: Select elements on webpage in same way as with the explorer - 01-06-2006 , 02:02 PM



Loop through your images, get their position and determine if they fall
into the selected area.
Make use of the offsetTop and offsetLeft properties of the image but
beware that it will give you the offset of their respective parents so
you have to do a recursive calculation but it depends on how you design
your layout.
Another good link that offers you a solution would be:
http://www.quirksmode.org/js/findpos.html

You simply calculate:

if (findPosX(img) >= dragStartX && findPosY(img) >= dragStartY) {
//it's selected }

you can do additional check to be inside completly the selected area.
The variables are self explanatory.

A good idea is to implement some kind of a grid layout to bring some
order into the chaos, to have some rules for displaying images.


Regards


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.