Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Hmmm, couldn't you use percentages instead? Seems to eliminate alot of code :)</p> <p>It seems you need to use a "STEP" proccess, to make sure they follow each other. Example of such can be found here <a href="http://www.protofunc.com/scripts/jquery/animate-step/" rel="nofollow">http://www.protofunc.com/scripts/jquery/animate-step/</a></p> <p><a href="http://jsfiddle.net/AUu9E/3/" rel="nofollow">http://jsfiddle.net/AUu9E/3/</a></p> <p>HTML</p> <pre><code>&lt;nav&gt; &lt;ul&gt; &lt;li class="liHome"&gt;home&lt;/li&gt; &lt;li class="liRsvp"&gt;rsvp&lt;/li&gt; &lt;li class="liStory"&gt;story&lt;/li&gt; &lt;li class="liVenue"&gt;venue&lt;/li&gt; &lt;li class="liGuestbook"&gt;guestbook&lt;/li&gt; &lt;li class="liGallery"&gt;gallery&lt;/li&gt; &lt;/ul&gt; &lt;/nav&gt; </code></pre> <p>JS</p> <pre><code>//Remove 1 element(selected), and find the width of the rest(unselected) var qtySect = 6-1; var unselectedWidth = 40 / qtySect +"%"; var selectedWidth = 60+"%"; //set initial widths $("nav ul li:first-child").addClass('selected'); $("nav ul li").not(':first-child').addClass('unselected'); $(".unselected").css("width", unselectedWidth); $(".selected").css("width",selectedWidth); //mouseover animate $("nav ul li").mouseenter(function() { if ($(this).hasClass("unselected")){ $(this).animate( { width: selectedWidth }, { queue: false, duration: 1000, easing: "linear" } ) $(".selected").animate( { width: unselectedWidth }, { queue: false, duration: 1000, easing: "linear" } ); $(".selected").addClass("unselected").removeClass("selected"); $(this).addClass("selected").removeClass("unselected"); } }); </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.
 

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