Moving the Div Region

Ask a Question related to Macromedia Dynamic HTML, Design and Development.

  1. #1

    Default Moving the Div Region

    Hello! I'm working on a site where I have some content in a div tag. I want
    this Div region to load when the page loads then move down the screen slowly.
    It then stops then after about 20 seconds it then moves back to the top of the
    screen then either fades out or disappear. This is the code that I have so far:

    <script language="JavaScript">

    objectLeftPos = 170;
    objectTopPos = 0;

    function moveDown() {
    if (document.all) {object = box.style}
    if (document.layers) {object = document.box}
    if (objectTopPos < 300) {
    objectTopPos += 1;
    object.top = objectTopPos;
    setTimeout("moveDown()",20)
    }
    }

    function moveUp() {
    if (document.all){object = box.style}
    if (document.layers) {object = document.box}
    if (objectTopPos = 300) {
    objectTopPos -= 1;
    object.top = objectTopPos;
    setTimeout("moveUp()",20)
    }
    }

    </script>

    Box is the id of the Div region. And on the body tag I have the following
    event : <body onload="moveDown(); moveUp()">

    The problem is that the div doesn't go back up as it is now. If I take out the
    moveUp() function from the body tag then it moves down slowly and stop where it
    is suppose to. Like I said I need for it to go down, stop, then move back up
    and disappear. Can anyone help me solve this problem.

    Thanks!

    Naughtytrini Guest

  2. Similar Questions and Discussions

    1. I know we can set max image width, but I need to set itby region. Region A has one max width; Region B another.
      We can already set a maximum image width for use globally, throughout every page. Can we do it by region? This way one region can have a max...
    2. Edit region
      I made a page in Dreamweaver with an edit region. But no matter which role I connect with I can still edit other parts of the page too. What am I...
    3. Sort Region
      I hope this is the correct forum for this. If not, I'd like to ask a moderator to direct me to the correct forum. Has anyone tried this...
    4. Moving Randomly Moving Sprite To New Location on mouseEnter
      Hi All, This is way over my head. I am currently using Director 8. I have a randomly moving sprite(call it X) on stage (I accomplished this...
    5. Repeating Region
      Hello all, I have a repeating region for a navigation bar. (Link | Link | Link) The repeating region looks like this: <REPEAT BEGIN><EDITABLE...
  3. #2

    Default Re: Moving the Div Region

    Not optimized but something like this should get you going at least...

    <script language="JavaScript">
    objectLeftPos = 170;
    objectTopPos = 0;
    function moveDown() {
    var
    object=document.getElementById?document.getElement ById("box").style:document
    ..box;
    if (objectTopPos < 300) {
    objectTopPos += 1;
    object.top = objectTopPos;
    setTimeout("moveDown()",20)
    }else{moveUp()}
    }

    function moveUp() {
    var
    object=document.getElementById?document.getElement ById("box").style:document
    ..box;
    if (objectTopPos >= 0) {
    objectTopPos -= 1;
    object.top = objectTopPos;
    setTimeout("moveUp()",20);
    }
    if(objectTopPos==0){
    object.visibility="hidden";}
    }
    </script>



    <body onload="moveDown()" etc...>


    Look for a wrap on the var object=document. line. You may have to unwrap
    this one. By the way, using getElementById will allow it to work in more
    browsers.


    --
    Regards,
    ...Trent Pastrana
    [url]www.fourlevel.com[/url]

    -----------------------------




    "Naughtytrini" <webforumsuser@macromedia.com> wrote in message
    news:cggn5s$aj0$1@forums.macromedia.com...
    > Hello! I'm working on a site where I have some content in a div tag. I
    want
    > this Div region to load when the page loads then move down the screen
    slowly.
    > It then stops then after about 20 seconds it then moves back to the top of
    the
    > screen then either fades out or disappear. This is the code that I have so
    far:
    >
    > <script language="JavaScript">
    >
    > objectLeftPos = 170;
    > objectTopPos = 0;
    >
    > function moveDown() {
    > if (document.all) {object = box.style}
    > if (document.layers) {object = document.box}
    > if (objectTopPos < 300) {
    > objectTopPos += 1;
    > object.top = objectTopPos;
    > setTimeout("moveDown()",20)
    > }
    > }
    >
    > function moveUp() {
    > if (document.all){object = box.style}
    > if (document.layers) {object = document.box}
    > if (objectTopPos = 300) {
    > objectTopPos -= 1;
    > object.top = objectTopPos;
    > setTimeout("moveUp()",20)
    > }
    > }
    >
    > </script>
    >
    > Box is the id of the Div region. And on the body tag I have the following
    > event : <body onload="moveDown(); moveUp()">
    >
    > The problem is that the div doesn't go back up as it is now. If I take
    out the
    > moveUp() function from the body tag then it moves down slowly and stop
    where it
    > is suppose to. Like I said I need for it to go down, stop, then move back
    up
    > and disappear. Can anyone help me solve this problem.
    >
    > Thanks!
    >

    T.Pastrana - 4Level Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139