Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I'm pretty sure everything's working correctly with your jQuery, but animating just the <code>opacity</code> doesn't magically change the <code>display</code> style from <code>none</code> to <code>block</code> or whatever the element's value is. I'm pretty sure you set a style for <code>.content</code> to have <code>display: none;</code>. When you animate the opacity, for the divs, their <code>display</code> stays as <code>none</code>, except the first one, because by default, it's overridden with <code>block</code>. Is there any reason you're animating <code>opacity</code> and not using something like <code>fadeIn()</code> and <code>fadeOut</code>?</p> <p>Also, since you're storing an <code>id</code> in the <code>href</code>, there's no need to do something like <code>$(id, local_responses)</code>...just use <code>$(id)</code>. Take a look at this:</p> <p><a href="http://jsfiddle.net/SgwyM/" rel="nofollow">http://jsfiddle.net/SgwyM/</a></p> <pre><code>var local_links = $(".local_links"); var local_responses = $(".local_responses"); $(local_links).on("click", "a", function(e){ e.preventDefault(); var id = $(this).attr("href"); local_links.find("div.arrow-selected").remove(); $(this).parent().append('&lt;div class="arrow-selected"&gt;&lt;/div&gt;'); $(".content", local_responses).fadeOut(400); $(id).delay(400).fadeIn(400); }); </code></pre> <p>And just to note, I changed the <code>on</code> binding because this way, it doesn't create an event handler for every <code>&lt;a&gt;</code> found - it creates one for each item in <code>local_links</code>, but is only executed for the selector <code>"a"</code>.</p>
    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. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      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