PDA

View Full Version : JavaScript or DHTML help for web images!!


seynn2001
06-09-2004, 01:22 PM
Hi there ppl.
Here is my doubt!

Im building a web site, and i whanted to put an image in the main site, over evrything else, like, over text and over images, like the image was on a new layer and the web site was the primary layer, i guess u understand what i mean.

So far i only found scripts that make smiliar things, but not what i whant :(, like this one:

<script language="JavaScript1.2">
var dragapproved=false
var z,x,y
function move(){
if (event.button==1&&dragapproved){
z.style.pixelLeft=temp1+event.clientX-x
z.style.pixelTop=temp2+event.clientY-y
return false
}
}
function drags(){
if (!document.all)
return
if (event.srcElement.className=="drag"){
dragapproved=true
z=event.srcElement
temp1=z.style.pixelLeft
temp2=z.style.pixelTop
x=event.clientX
y=event.clientY
document.onmousemove=move
}
}
document.onmousedown=drags
document.onmouseup=new Function("dragapproved=false")
</script>

<img src="Image5.gif" class="drag">

That script does what i whant but with one thing that i dont whant, drag and drop.

I just whant to place the image were i whant, and leave it there. I dont whant ppl to drag it.

Because i whant to put a image in the middle-right side of the page, over text and other images, and just leave it there.
I also dont whant one that when u scroll the page it always stays there, stiky..no..

i whant it to be "part" of the page, just like if pasted it over the site, like when we are playing with a photo, when u ad a background image or so...

I guess u already know what i mean!

Can anyone help me out with this? What do i need to do to make this?

Thanx ppl

pascal
06-10-2004, 02:48 AM
search google for 'z-index'

seynn2001
06-10-2004, 01:46 PM
<style type="text/css">

img#zelda {
position:absolute;
right:10px;
z-index:3;
}

</style>
<img id="zelda" src="Image5.gif">

This is the css code i have, it works for put the image static on the right side of the page, so far so good, but i what to put the image a little bit bellow on the page, but if i ad this:

<style type="text/css">

img#zelda {
position:absolute;
bottom:10px;
right:10px;
z-index:3;
}

</style>
<img id="zelda" src="Image5.gif">

..the image moves when the page scrolls..and i just whant it to be static were i whant it to be, not scrolling along the rest.

On that code, how can i ad something to allow me to move it verticaly but still remain static?

pascal
06-11-2004, 05:17 AM
I tryed your code, and the image didn't scrolled along with the page.
Is used this:

<html>
<head>
<title>Untitled</title>
<style type="text/css">

img#zelda {
position:absolute;
bottom:10px;
right:10px;
z-index:3;
}

</style>

</head>

<body>
<img id="zelda" src="Image5.gif">
<br>V
<br>V
<br>V
<br>V
<br>V
<br>V
<br>V
<br>V
<br>V
<br>V
<br>V
<br>V
<br>V
<br>V
<br>V
<br>V
<br>V
<br>V
<br>V
<br>V
<br>V
<br>V
<br>V
<br>V
<br>V
<br>V
<br>V
<br>V
<br>V
<br>V
<br>V
<br>V
<br>V
<br>V
<br>V
<br>V
</body>
</html>

When I then scroll down, the image stays where he is.
I got IE6.0

livingatlantis
06-11-2004, 07:37 AM
People, a newbie question here.

For multiple line breaks, should I use the <p>&nbsp;</p> or just tons of <br>? :o

pascal
06-12-2004, 10:04 AM
Tons of <br>.

Definately.


<p>&nbsp;</p> = frontpage-puke.

azlatin2000
06-12-2004, 10:44 AM
To make it stay in the same place, look up on google, "watermark generator css"

livingatlantis
06-12-2004, 08:24 PM
@pascal: Thanks :D That'll make it easier :D

@azlatin2000: Not to ignore you're post lol, sorry.

azlatin2000
06-13-2004, 09:34 AM
oops wrong thread, i had to many tabs open at the same time.

livingatlantis
06-14-2004, 04:48 AM
Oh! :D Are you a Firefox user, or Opera? :o