The "Freeola Customer Forum" forum, which includes Retro Game Reviews, has been archived and is now read-only. You cannot post here or create a new thread or review on this forum.
Does anyone know, using JS, if you can add or subtract from or to the value of the 'top' and 'left' in real time, seemingly moving a layer by, say, clicking the mouse with if(event.button==1){LAYER CODE CONTENT}.
Cheers.
> Yeah I took both of Thau's from webmonkey.
:-)
The beginners one was good but I didn't think he explained everything all that well in the Advanced one. So I looked around for others and took bits of them all :-)
> Webmonkey?
The beginners one yah. The advanced was a hybrid really. A bit of webmonkey and HTML Goodies and some from pageresource.com
> cjh wrote:
> Where do you learn all your stuff??
>
> Trial and error mostly.
>
> I took two JS tutorials. A beginners one and an advanced one. And that
> was it.
Webmonkey?
> Where do you learn all your stuff??
Trial and error mostly.
I took two JS tutorials. A beginners one and an advanced one. And that was it. If I think up an idea for a script I work my way around it, applying what I learnt in the tutorials and what other stuff I've picked up from looking at source code and try and make the script. I try and try again until I've got no more ideas. And if it still doesn't work I either look on the Net or I come here for help.
Like Rob said, mostly it's practice.
When you look at the Internet, what you're looking at is the sum total and collection of the history of mankind's knowledge and experiences in one gigantic library. Anything the has ever been known before is learnable on the Internet. All you need is a stepladder.
Should be layer.style.left+=i
whoops.
> Hi,
>
> Does anyone know, using JS, if you can add or subtract from or to the
> value of the 'top' and 'left' in real time, seemingly moving a layer
> by, say, clicking the mouse with if(event.button==1){LAYER CODE
> CONTENT}.
>
> Cheers.
Yup. Tis simple.
var i=0;
var timer;
function moveLeft()
{
if (i < 250)
layer.style.position="relative";
layer.style.position+=i;
i++
}
else if (i == 250)
{
clearTimeout(timer)
}
timer=setTimeout("moveLeft()",10)
}
then just make the layer in CSS and give it a relatie position. Make the call and it'll start moving. Simple.