Note that there are some explanatory texts on larger screens.

plurals
  1. POProblem with li class image swap and jQuery slide on mouseover
    primarykey
    data
    text
    <p>Sorry if this is misleading, I'm fairly new at Java-script and jQuery. Can anyone tell me how to make a navigation link slide left on mouseover and slide back on mouseout? The li classes I am trying to individually slide on mouseover are used in this <a href="http://www.designchemical.com/blog/index.php/jquery/jquery-image-swap-gallery/" rel="nofollow">gallery image swap</a> script. I have a left navigation plane with images that will change the corresponding image to the right on hover. </p> <pre><code>&lt;script type&gt; $(document).ready(function() { // Image swap on hover $("#gallery ul li img").hover(function(){ $('#main-img').attr('src',$(this).attr('src').replace('thumb/', '')).stop().hide().fadeTo("slow",1); }); // Image preload var imgSwap = []; $("#gallery ul li img").each(function(){ imgUrl = this.src.replace('thumb/', ''); imgSwap.push(imgUrl); }); $(imgSwap).preload(); }); $.fn.preload = function() { this.each(function(){ $('&lt;img/&gt;')[0].src = this; }); } &lt;/script&gt; </code></pre> <p>li classes contained within<code>$("#gallery ul li img").hover(function(){</code> are what I want to slide indvidually on mouseover and back on mouseout. Ive tried</p> <pre><code>$("##gallery ul li img").hover(function(){ $("gallery ul.home", this).stop().animate({left:"150px"},{queue:false,duration:200}); }, function() { $("gallery ul.home", this).stop().animate({right:"0px"},{queue:false,duration:200}); </code></pre> <p>But this seems to break <code>.hover(function(){</code> </p> <p>HTML:</p> <pre><code>&lt;div id="gallery"&gt; &lt;img src="images/gallery/home.png" alt="" id="main-img" /&gt; &lt;ul&gt; &lt;li class="home"&gt;&lt;img src="images/gallery/thumb/home.png" alt="" /&gt;&lt;/li&gt; &lt;li class="about"&gt;&lt;img src="images/gallery/thumb/About Us.png" alt="" /&gt;&lt;/li&gt; &lt;li class="contact"&gt;&lt;img src="images/gallery/thumb/Contact Us.png" alt="" /&gt;&lt;/li&gt; &lt;li class="services"&gt;&lt;img src="images/gallery/thumb/Services.png" alt="" /&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; </code></pre> <p>CSS:</p> <pre><code>#body #left_nav #gallery #main-img { position: absolute; left: 400px; top: 20px; right: auto; bottom: auto; } #body #left_nav #links #gallery ul li{ display: inline; clip: rect(auto,3px,auto,auto); height: 500px; width: 300px; } #body #left_nav #gallery ul .home { position: absolute; left: 117px; top: 74px; list-style-image: none; list-style-type: none; } #body #left_nav #gallery ul .about { position: absolute; left: 88px; top: 176px; list-style-image: none; list-style-type: none; } #body #left_nav #gallery ul .contact { position: absolute; left: 80px; top: 277px; list-style-image: none; list-style-type: none; } #body #left_nav #gallery ul .services { position: absolute; top: 385px; list-style-image: none; list-style-type: none; left: 98px; } </code></pre>
    singulars
    1. This table or related slice is empty.
    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.
 

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