The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Web Design
> CSS Help
|
get coordinates and place gfx (CSS)
Discuss get coordinates and place gfx (CSS) in the CSS Help forum on Dev Shed. get coordinates and place gfx (CSS) Cascading Style Sheets (CSS) forum discussing all levels of CSS, including CSS1, CSS2 and CSS Positioning. CSS provides a robust way of applying standardized design concepts to your web pages.
|
|
 |
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

April 4th, 2001, 09:15 AM
|
|
Junior Member
|
|
Join Date: Apr 2001
Location: UK
Posts: 6
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
In essence I'm trying the grab the pixel coordinates from an onClick event (over a predefined image), and use these coordinates to place a small graphic.
The main problem is dynamically generating the DIV tags to insert an extra graphic along with the appropriate LEFT and TOP styles - LEFT and top being the pixel coords grabbed from clicking the 'main' image.
phew!
Can anyone please help.
Cheers
|

April 4th, 2001, 12:34 PM
|
|
|
|
Do you need to dynamically create a DIV or can you already have the DIV, but have it's visibility property be 'hidden', then when you want it displayed, move it's position dynamically and change the its visibility state dynamically?
__________________
 Michael
|

April 4th, 2001, 12:39 PM
|
|
Junior Member
|
|
Join Date: Apr 2001
Location: UK
Posts: 6
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
Thanks for you reply Pieux!
Dynamically creating the DIV would be ideal as the number of 'clicks' to the image will not be know. By doing this we can then display this small graphic on top at each click without being restricted to a finite number.
Any suggestions?
|

April 4th, 2001, 12:43 PM
|
|
|
|
Wow, that was quick!
I think I understand what you are trying to do, but I fail to see where you get an advantage in dynamically creating the DIV as opposed to already having it there. Do you want to have one image for each individual click? Could you provide a specific example? There might be a different (possibly better) way of accomplishing your ultimate goal.
|

April 4th, 2001, 12:54 PM
|
|
Junior Member
|
|
Join Date: Apr 2001
Location: UK
Posts: 6
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
Yeh, the idea is a user will click an image, and based on that click a small image of a cross will be placed on top.
Current working is that a string of pixel coordinates are collected anyway, which I thought could be used to populate the LEFT and TOP values the style...or something of that effect.
This is quite new to me, so I could well be looking at a very difficult methodology.
p.s. the image used is the same for each point
|

April 4th, 2001, 01:04 PM
|
|
|
Here's a thought
How about if you create, say, 200 <div>s, each with incremental names. Then, as the user clicks, you change the position of a different <div> (incrementing through your list up to 200). Once you reach the 200th <div>, you start at number 1 again. This is a technique used by people that develop first-person shooter type games in order to put a cap on how much memory is consumed with things like bullet holes. If you don't do this, you will probably risk running out of memory and not having any way of freeing it up, short of leaving that page or closing the browser (which will in effect be leaving the page).
|

April 6th, 2001, 04:03 PM
|
|
Contributing User
|
|
Join Date: Mar 2001
Location: san francisco
Posts: 30
Time spent in forums: < 1 sec
Reputation Power: 13
|
|
|
2cents
it isn't super clear to me: do you need multiple crosses on the screen, or do you want the same one to appear each time?
if only one, you could set a timer on it, so it hides itself again after 3 seconds, and then on the next click, either shows itself again, or if it hasn't yet vanished, it could just reset the timer.
just a thought. i'm a big fan of timers in general.
pieux is right tho, i think: don't bother dynamically writing out the divs, just more and show them as you need them. should save you a little headache.
rgds,
darwin
|

April 8th, 2001, 02:22 PM
|
|
Junior Member
|
|
Join Date: Apr 2001
Location: UK
Posts: 6
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
thank you
Thanks for your help guys, I have taken the approach suggested by Pieux of incrementally naming several hidden DIVs, and moving them based on a users' onClick event. Works very well.
Thanks again
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|