FF error?

S

sara

Hi at all,
please take a look here.
I have:
<body onload="STT();">
<div id="panorama" style="width:100%; height:150px; border:1px solid
red;overflow:hidden">
<img src="images/veylargeimage.jpg" alt="" /></div>
This js code move automatically image up or down, left or right.
It work fine wirh MSIE, Opera, Safara and Chrome but not
with FireFox
Why please?
var rollo;
var b=1;
var c=1;
function STT()
{
setInterval(function(){rollo=document.getElementById('PANORAMA');rollo.scrollTop+=b;rollo.scrollLeft+=c;if
(rollo.scrollTop==450){b=-1;}if (rollo.scrollTop==300){b=1;}if
(rollo.scrollTop==355){c=-1;}if (rollo.scrollTop==450){c=1;}}, 40);}
 
S

Stevo

sara said:
Hi at all,
please take a look here.
I have:
<body onload="STT();">
<div id="panorama" style="width:100%; height:150px; border:1px solid
red;overflow:hidden">
<img src="images/veylargeimage.jpg" alt="" /></div>
This js code move automatically image up or down, left or right.
It work fine wirh MSIE, Opera, Safara and Chrome but not
with FireFox
Why please?
var rollo;
var b=1;
var c=1;
function STT()
{
setInterval(function(){rollo=document.getElementById('PANORAMA');rollo.scrollTop+=b;rollo.scrollLeft+=c;if
(rollo.scrollTop==450){b=-1;}if (rollo.scrollTop==300){b=1;}if
(rollo.scrollTop==355){c=-1;}if (rollo.scrollTop==450){c=1;}}, 40);}

Usually if something dealing with DIVs is working on everything except
Firefox, it can be because FF needs +"px" adding when assigning a value
that is in pixels. I don't know if it applies here. Try
rollo.scrollTop=(rollo.scrollTop+b)+"px" for example. Same for scrollLeft.

Don't worry about Thomas, he thinks everyone should use a valid email
address for posting here, and he thinks it says so in the group FAQ but
it doesn't. He's welcome to increase his spam input, but there's no need
for the rest of us to. This is a newsgroup. Replies are sent to the
group, so there's no value in using a real email address. If it was
enforced, then people would just create a dummy gmail/yahoo/hotmail
account and never bother looking at it, so what's the point.
 
M

Matthias Reuter

Sara said:
<div id="panorama"> ^^^^^^^^

setInterval(function(){
rollo=document.getElementById('PANORAMA');
^^^^^^^^

I'm surprised, this works in any browser.
 
S

sara

"Thomas 'PointedEars' Lahn"

wrote:

Make it worth a look first. That includes, but is not limited to,
posting with a From header that observes the posting conventions.
Until then, consider yourself killfiled.

<http://jibbering.com/faq/#posting>


PointedEars

Mentre il saggio indica la luna.............

..............lo stolto guarda il dito !
 
L

Lasse Reichstein Nielsen

The "PANORAMA" here should be "panorama". Id's are case sensitive.
Usually if something dealing with DIVs is working on everything except
Firefox, it can be because FF needs +"px" adding when assigning a
value that is in pixels. I don't know if it applies here. Try
rollo.scrollTop=(rollo.scrollTop+b)+"px" for example. Same for
scrollLeft.

Doesn't apply.
The "px" is required for CSS properties, but scrollTop and scrollLeft
are not CSS and are plain number properties.

Anyway: It works for me in Firefox (with the correct id, but it didn't
work in Chrome with the wrong one either)
If it was enforced, then people would just create a dummy
gmail/yahoo/hotmail account and never bother looking at it, so
what's the point.

Inconceivable!
/L '*cough*'
 
S

sara

"Lasse Reichstein Nielsen"
wrote:
....................................................

Lasse Reichstein Holst Nielsen
'Javascript frameworks is a disruptive technology'
Thank you Lasse
I tryed adding "px" ((but I am not sure that is right to add it)) but there
are not news and FF does'nt work. It go down but it does'nt go up.

chrome works fine like opera and MSIE 8

Now panorama is lower case

This is new code working better with MSIE8, opera and chrome

I chenged setinterval with settimeout to try but result is the some and FF
does'nt work

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<HTML>

<HEAD>

<TITLE> New Document </TITLE>

<script type="text/javascript">

var rollo;

var b=1;

var c=1;

function STT()

{

setTimeout(function(){rollo=document.getElementById('panorama');(rollo.scrollTop+=b)+"px";(rollo.scrollLeft+=c)+"px";if
(rollo.scrollTop==450){b=parseInt(-1);}if
(rollo.scrollTop==300){b=parseInt(1);}if
(rollo.scrollTop==355){c=parseInt(-1);}if
(rollo.scrollTop==450){c=parseInt(1);}STT();}, 40);}

</script>

</HEAD>

<body onload="STT();">

<div id="panorama" style="width:100%; height:150px; border:1px solid
red;overflow:hidden">

<img src="images/veylargelogo.jpg" />

</div>

</BODY>

</HTML>
 
E

Eric Bednarz

Matthias Reuter said:
Because ids are case sensitive.

In XHTML, yes. In HTML, it depends. The normative prose says they are
case sensitive, the normative syntax says they are subject to case
folding (funny enough, if HTML were parsed by SGML rules, the above
would be the only right way to go about it :).

For sane practical usage your statement is correct though.
 
H

Holger Suhr

sara said:
function STT()

{

setTimeout(function(){rollo=document.getElementById('panorama');(rollo.scrollTop+=b)+"px";(rollo.scrollLeft+=c)+"px";if

this code has no effect...
if scrollTop needs the 'px'
rollo.scrollTop=(parseInt(rollo.scrollTop)+b)+'px';
otherwise
rollo.scrollTop+=b;
(rollo.scrollTop==450){b=parseInt(-1);}if
(rollo.scrollTop==300){b=parseInt(1);}if
(rollo.scrollTop==355){c=parseInt(-1);}if
(rollo.scrollTop==450){c=parseInt(1);}STT();}, 40);}

</script>

</HEAD>

<body onload="STT();">

<div id="panorama" style="width:100%; height:150px; border:1px solid
red;overflow:hidden">

<img src="images/veylargelogo.jpg" />

</div>

</BODY>

</HTML>

I just wrote a panoramaviewer some days ago.
I used
-----------
<div id='panorama' style='width:700px; height:150px; overflow=hidden'>
<img id=thePic' src="images/veylargelogo.jpg">
</div>
-----------

and in the code

-----------
var pic=document.getElementById('thePic');
Xoff+=x;
Yoff+=y;
Fit(); // recalculate if picture moves out of the frame

pic.style.marginLeft='-'+Xoff+'px';
pic.style.marginTop='-'+Yoff+'px';
-----------

it works nice in FF 3.0.10, Opera 9.24, IE6, IE7

With this Viewer, I can zoom in and out and drag the picture with
mousemoves to the corners.

If you'd like to see the code, I'll send you a mail.

Holger
 
S

sara

"Holger Suhr"

wrote:
If you'd like to see the code, I'll send you a mail.

Holger

I thank you very much Holger (I wrote you) but please remember that my
panorama is differente then others.

My panorama don't show a panaroma from start-to-last- to-start but it is
like a slow dance.

It dance around an elipse

It is for that that I like to do work my code with FF also
 
H

Holger Suhr

sara said:
"Holger Suhr"

wrote:


I thank you very much Holger (I wrote you) but please remember that my
panorama is differente then others.

My panorama don't show a panaroma from start-to-last- to-start but it is
like a slow dance.

It dance around an elipse

It is for that that I like to do work my code with FF also
He he, I think my viewer it, too.
Not an ellipse, but a sinewave.

The code is in the cable per pm.

Holger
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top