473,287 Members | 1,904 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,287 software developers and data experts.

Moving div tags in Firefox with setInterval

I am working on a site where we are doing some experamental Javascript and Flash actionscript. Basicly, at a certain point the flash movie tells the javascript function on the page to move the div that conatins the flash movie off the page to the right.

I finally got everything to work, by using window.setInterval(); to start calling a function that moves the div off the screen by 5px untill it reached 1000 px.

The problem is that in Firefox the div will stop in place and not move but when you click another window, you can see it moving in the background fine. This is really weird.

I was wondering if there is a better way than changing the x coord of a div other than the style.left = with css?

not sure if this helps but here is the code:
Expand|Select|Wrap|Line Numbers
  1. var b         = browserCheck();
  2.     var moveID     = 0;
  3.     var win     = window.self;
  4.     var gcDiv,glDiv,grDiv,off;
  5.  
  6.     function setVars(){
  7.         gcDiv     = MM_findObj('greenCover');
  8.         glDiv     = MM_findObj('greenleft');
  9.         grDiv    = MM_findObj('greenright');
  10.         off     = gcDiv.offsetLeft;
  11.     }
  12.     function moveToRight(){
  13.         if(glDiv.style.display != 'block'){glDiv.style.display = 'block';};
  14.         if(off < 1000){
  15.             off = off + 5; gcDiv.style.left = off + "px";
  16.         }else{gcDiv.style.display = "none"; win.clearInterval(moveID);}
  17.         //document.getElementById("output").innerHTML = gcDiv.style.left;
  18.     }
  19.     function int_moveToRight(){
  20.         moveID = win.setInterval(moveToRight, 10);
  21.     }
Code tags please - MODERATOR
Jun 25 '07 #1
4 5170
acoder
16,027 Expert Mod 8TB
Welcome to TSDN!

Can you give more code, e.g. the HTML/CSS. Alternatively, give a link to a test page.
Jun 26 '07 #2
shoonya
161 100+
i can't any recursion / loop sort of thing which will make your page move
(may be i am missing some thing)

but when the div reaches the given position, just make it's
Expand|Select|Wrap|Line Numbers
  1. document.getElementById('div_id').style.display="none"
  2.  
i think it should work fine

shoonya
Jun 26 '07 #3
Never mind this post.

This is a messed up way of doing the same effect that I could do with all flash. Plus, every browser I've tested it in, it's differant or it dosn't work at all.

-J
Jun 27 '07 #4
shoonya
161 100+
it's bit messy
but it has got it's own advantage,
you don't need any extra falsh plug-in to display this thing :D

shoonya
Jun 28 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: Fabri | last post by:
I have to move 2 layers (one from up to center and one from bottom to center) and I found this way: <div id="up" style="position:absolute;left:10px;top:-20px">Up</div> <div id="down"...
1
by: Muffinman | last post by:
Howdy, I've got here a sample of my function which is supposed to fade a certain piece of text to another colour. This line is then located in a for loop and it works pretty well in IE 6....
4
by: Jake j | last post by:
To those of you who sent me working examples of js include routines, much thanks. I see from them examples that what I'm trying to get to requires a higher level of js knowledge than I've got. ...
5
by: Donius | last post by:
I am making some popup windows, and then trying to load content into them. It can be as few as two windows, and as many as 15 or so. I'm running into a problem where firefox cannot find the...
3
by: Csaba Gabor | last post by:
Firefox's configuration settings (Prefs.js) can be accomplished via the interface at about:config. Q1. Is there any such setting that can be repeatedly altered via javascript (in a vanilla...
8
by: hyejin | last post by:
I have a problem with dynamic iframe and document.close() on Firefox. Below two files create a dynamic iframe by JavaScript. These two samples do not have any problems on IE. But, on Firefox, the...
1
by: JohnIdol | last post by:
Hi all, a quick one here. I am moving elements on the page clientside and I am going through strange issues. This one works: <html> <head> <title>Javascript Text</title>
3
by: Cartoper | last post by:
I would like to design a web page as follows: There is a box (box A) with some things in it that the user can click on. When an item is clicked, another box (box B) moves in from the right side...
1
by: littlealex | last post by:
IE6 not displaying text correctly - IE 7 & Firefox 3 are fine! Need some help with this as fairly new to CSS! In IE6 the text for the following page doesn't display properly - rather than being...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.