Note that there are some explanatory texts on larger screens.

plurals
  1. POfadeIn DIV affecting other div values
    primarykey
    data
    text
    <p>I'm new to jquery and javascript in general so I'm having some trouble figuring things out. Right now, I want an image to animate downward (iphone) while an image fades in (shadow) while another image animates upwards (reflection) while fading in. The code I have now just fades everything in at the same speed (doesn't matter if each div has different time values). Also, if I try to animate the reflection, it just pulls all the elements down (if I edit the start value of the div). This is probably because the reflection is the first element in the "wrap" div. I can't really change this because I want the iphone overlapping the shadow which overlaps the reflection. So, I need to initiate the reflection div first (I tried using z values which didn't work). Any tips? Here is the code: </p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html lang="en"&gt; &lt;head&gt; &lt;script src="jquery-1.3.2.min.js" type="text/javascript"&gt;&lt;/script&gt; &lt;link rel=StyleSheet href="external_style_sheet.css" type="text/css"&gt; &lt;script type="text/javascript"&gt; $(function() { $('#iphone').animate({"top" : "1000px"}, 1200); $('#shadow').fadeIn(1800); $('#reflection').fadeIn(1800); }); &lt;/script&gt; &lt;/head&gt; &lt;body id="index" class="home"&gt; &lt;div id="wrap" &gt; &lt;div id="left" /&gt; &lt;div id="right" &gt; &lt;div id="reflection" /&gt; &lt;div id="shadow" /&gt; &lt;div id="iphone" /&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>And the CSS</p> <pre><code> `p {font-family: georgia, serif; font-size: x-small;} hr {color: #000000; height: 1px } a:hover {color: #ff0000; text-decoration: none} body { background-color:#1b1a1f; } #reflection { margin-top:0px; margin-left: 400px; position:relative; width: 414px; height: 993px; background-image: url("images/reflection2.png"); display: none; z-index: -1; } #shadow { margin-top:0px; margin-left: 0px; position:absolute; width: 414px; height: 818px; background-image: url("images/shadow3.png"); display: none; z-index: 1; } #iphone { margin-top:-1000px; margin-left: 0px; position:relative; width: 414px; height: 818px; background-image: url("images/iphone_2.png"); z-index: 0; } #wrap { width:800px; margin:0 auto; background-image: url("images/logo.png"); } #left { float:left; width:500px; } #right { float:right; width:500px; } HTML &lt;div id="bar"&gt;Content&lt;/div&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload