title: If href equals id of another div do function
body: <p>I have a hidden div with the details of a thumbnail that is visible on the page. When you click on the thumbnail, it should fadein or slideup the div with details. </p>
  
  <p>I have set with jquery incremented ID's to each ".portfolio-item-details" to identify each one and then have set with jquery the same ID's to the href of the thumbnail.</p>
  
  <pre><code>&lt;section id="portfolio1" class="portfolio-item-details hidden"&gt;content&lt;/section&gt;
  &lt;a class="open-portfolio-item-details" href="#portfolio1" title=""&gt;
    &lt;img src="thumbnail.jpg"&gt;
  &lt;/a&gt;
  &lt;section id="portfolio2" class="portfolio-item-details hidden"&gt;content&lt;/section&gt;
  &lt;a class="open-portfolio-item-details" href="#portfolio2" title=""&gt;
    &lt;img src="thumbnail.jpg"&gt;
  &lt;/a&gt;
  </code></pre>
  
  <p>Since this is done dynamically, how can I with jquery fadeIn or slideUp the ".portfolio-item-details" if the href is equal to the ID. Basically thumbnail with "#portfolio1" should slide up the div with "#portfolio1" on click.</p>
  
  <p>This is my jquery code which to add the IDs and HREF is working perfectly but not working to slideUp or fadeIn the div with the same ID.</p>
  
  <pre><code>$(document).ready(function () {    
   var i=0;
   $(".portfolio-item-details").each(function(){
        i++;
        var newID="portfolio"+i;
        $(this).attr("id",newID);
        $(this).val(i);
   });
   var i=0;
   $(".open-portfolio-item-details").each(function(){
        i++;
        var newReadMoreHREF="#portfolio"+i;
        $(this).attr("href",newReadMoreHREF);
        $(this).val(i);
        if ($(".portfolio-item-details").attr("id") == "newReadMoreHREF") {
          $(this).fadeIn();
        }
   });
  });
  </code></pre>
  
  <h1>SOLUTION</h1>
  
  <p>Thanks to Austin's code, I was able to modify it to work with mine.
  Check here: <a href="http://jsfiddle.net/jdoimeadios23/xpsrLyLz/" rel="nofollow">http://jsfiddle.net/jdoimeadios23/xpsrLyLz/</a></p>