Note that there are some explanatory texts on larger screens.

plurals
  1. POjavascript image pan 'blocking' nav links and making div elements opaque
    primarykey
    data
    text
    <p>I have an image, bg, embedded in a div using CSS just above the footer. The idea is when the mouse moves left or right, the image moves along with it. The Javascript above /body is what causes this to work. It works well, but the nav links are now unclickable and the content divs are opaque where you can see the bg image through them. When I remove the #bg div, everything works fine. Any ideas how to fix it? HTML and CSS are below. I got this from tutorial here: <a href="http://www.dnitza.com/super-simple-panning-background/" rel="nofollow">panning</a>.</p> <pre><code>&lt;!DOCTYPE HTML&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;portfolio&lt;/title&gt; &lt;meta http-equiv="content-type" content="text/html;charset=utf-8"/&gt; &lt;link rel="shortcut icon" href="img/favicon.ico"&gt; &lt;link rel="stylesheet" type="text/css" href="css/reset.css"&gt; &lt;link rel="stylesheet" type="text/css" href="css/web.css"&gt; &lt;script src="js/modernizr.custom.js"&gt;&lt;/script&gt; &lt;script src="js/modernizr-2.6.2.min.js"&gt;&lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="site"&gt; &lt;header&gt; &lt;nav&gt; &lt;ul&gt; &lt;li&gt;&lt;a href="index.html"&gt;HOME&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;img src="img/lightning.png" alt="lightning" width="10" height="16"&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="portfolio.html"&gt;PORTFOLIO&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;img src="img/lightning.png" alt="lightning" width="10" height="16"&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="code.html"&gt;CODE&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;img src="img/lightning.png" alt="lightning" width="10" height="16"&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="contact.html"&gt;CONTACT&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/nav&gt; &lt;/header&gt; &lt;div id="left_col1"&gt; &lt;a href="../photo_collection_blom/index.html" target="blank"&gt;&lt;img src="img/10.png" alt="image" width="280" height="170" class="fade"&gt;&lt;/a&gt; &lt;p&gt;lorem ipsum&lt;/p&gt; &lt;/div&gt; &lt;div id="mid_col1"&gt; &lt;a href="../non_profit/index.html" target="blank"&gt;&lt;img src="img/vpf.png" alt="image" width="280" height="170" class="fade"&gt;&lt;/a&gt; &lt;p&gt;lorem ipsum&lt;/p&gt; &lt;/div&gt; &lt;div id="right_col1"&gt; &lt;a href="../cd/index.html" target="blank"&gt;&lt;img src="img/cd.png" alt="image" width="280" height="170" class="fade"&gt;&lt;/a&gt; &lt;p&gt;lorem ipsum&lt;/p&gt; &lt;/div&gt; &lt;div class="clearfix"&gt;&lt;/div&gt; &lt;div id="left_col2"&gt; &lt;a href="../zen/zen.html" target="blank"&gt;&lt;img src="img/zen.png" alt="image" width="280" height="170"&gt;&lt;/a&gt; &lt;p&gt;lorem ipsum&lt;/p&gt; &lt;/div&gt; &lt;div id="mid_col2"&gt; &lt;a href="../practicum/index.html" target="blank"&gt;&lt;img src="img/practicum.png" alt="image" width="280" height="170"&gt;&lt;/a&gt; &lt;p&gt;lorem ipsum&lt;/p&gt; &lt;/div&gt; &lt;div id="right_col2"&gt; &lt;a href="../dropdown_nav/index.html" target="blank"&gt;&lt;img src="img/navs.png" alt="image" width="280" height="170"&gt;&lt;/a&gt; &lt;p&gt;lorem ipsum&lt;/p&gt; &lt;/div&gt; &lt;div class="clearfix"&gt;&lt;/div&gt; &lt;div id="left_col3"&gt; &lt;a href="http://centralpaintstore.com" target="blank"&gt;&lt;img src="img/cps.png" alt="image" width="280" height="170"&gt;&lt;/a&gt; &lt;p&gt;lorem ipsum&lt;/p&gt; &lt;/div&gt; &lt;div id="mid_col3"&gt; &lt;img src="img/88.png" alt="image" width="280" height="170"&gt; &lt;p&gt;lorem ipsum&lt;/p&gt; &lt;/div&gt; &lt;div id="right_col3"&gt; &lt;img src="img/99.png" alt="image" width="280" height="170"&gt; &lt;p&gt;lorem ipsum&lt;/p&gt; &lt;/div&gt; &lt;div class="clearfix"&gt;&lt;/div&gt; &lt;div id="bg"&gt;&lt;/div&gt; &lt;footer&gt; &lt;p&gt;lorem ipsum&lt;/p&gt; &lt;/footer&gt; &lt;/div&gt; &lt;!-- close site --&gt; &lt;script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"&gt;&lt;/script&gt; &lt;script&gt;window.jQuery || document.write('&lt;script src="js/jquery-1.9.1.min.js"&gt;&lt;\/script&gt;')&lt;/script&gt; &lt;script&gt; $(document).ready(function () { $('#bg').mousemove(function (e) { var mousePos = (e.pageX / $(window).width()) * 100; $('#bg').css('backgroundPosition', mousePos + '% 0'); }); }); &lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>CSS:</p> <pre><code>* { text-decoration:none; font-family:Helvetica, sans-serif; z-index:100; } html { background:url(../img/background.gif); height:100%; } body { height:100%; z-index:100; } #site { width:1200px; min-height:100%; margin:auto; position:relative; z-index:100; } header { background:url(../img/background_design.jpg); height:63px; padding-top:25px; z-index:100; } nav { width:500px; padding:10px; margin:auto; font-family:helvetica, arial, sans-serif; font-size:1.2em; color:#dcd8cf; z-index:100; } nav ul { word-spacing:20px; } li { display:inline; margin:auto; } a:link { color:#dcd8cf; } /* unvisited link */ a:visited { color:#e25d33; } /* visited link */ a:hover { color:#e25d33; } /* mouse over link */ a:active { color:#e25d33; } /* selected link */ p { font-family:Arial, Helvetica, sans-serif; color:#000; line-height:1.2em; margin:10px 5px 20px 5px; } #site p a:link { color:#ed1b24; } #site p a:visited { color:#ed1b24; } #site p a:hover { text-decoration:underline; } #site p a:active { color:#ed1b24; } h3 { font-family:helvetica, arial, sans-serif; font-size:1.5em; color:#000; margin:20px; } #bg { background:url(../img/boston_skyline4.png) no-repeat 0 0 scroll; height:auto; left:0; min-height:100%; min-width:1024px; overflow:hidden; position:fixed; top:0; width:100%; z-index:1; } #left_col1, #left_col2, #left_col3 { border:1px solid #e0dfdf; width:280px; height:384px; margin-left:120px; margin-right:20px; background:white; padding:10px; overflow-x:scroll; float:left; z-index:100; } .clearfix { height:20px; clear:both; } #mid_col1, #mid_col2, #mid_col3 { border:1px solid #e0dfdf; width:280px; height:384px; margin-right:20px; background:white; padding:10px; overflow-x:scroll; float:left; z-index:100; } #right_col1, #right_col2, #right_col3 { border:1px solid #e0dfdf; width:280px; height:384px; background:white; padding:10px; overflow-x:scroll; float:left; z-index:100; } #left_col1, #mid_col1, #right_col1 { margin-top:20px; } #left_col3, #mid_col3, #right_col3 { margin-bottom:20px; } footer { background:url(../img/footer.gif); margin:auto; position:absolute; bottom:0; width:1200px; height:55px; } footer p { font-family:helvetica, arial, sans-serif; color:#e0dfdf; font-size:.9em; margin:auto; padding-top:1.5em; padding-left:1.5em; } </code></pre>
    singulars
    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.
 

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