Note that there are some explanatory texts on larger screens.

plurals
  1. PONeed help fixing bugs and optimizing javascript code
    primarykey
    data
    text
    <p>I've been working on enhancing this webpage and I'm sure you'll all laugh when you see the following code, but I've been teaching myself javascript as I go, so I'm a little proud of how far I've been able to get on my own. The problem is that what I've done is a little bit buggy once you start clicking on several cities on the map and I'm not versed enough to figure it out. Also, I'm sure I've taken the long scenic route in getting the code to function so I'm turning to all-knowing community in hopes someone can teach this guy how to code.</p> <p>You can see the full development here: <a href="http://buhmanphotography.com/map/" rel="nofollow">http://buhmanphotography.com/map/</a></p> <p>Here is a video of the bugs I'm seeing: <a href="http://buhmanphotography.com/map/buggyCode/" rel="nofollow">http://buhmanphotography.com/map/buggyCode/</a></p> <pre><code>$(document).ready(function() { // Show the Map Container $('.locBox a').click(function (e) { // Initialize info for clicked location var initLocInfo = $(this).attr("rel") + "Ctn"; // Show Initial Information $('#' + initLocInfo).show(); $('#' + initLocInfo).css('opacity','1'); $('#' + initLocInfo).addClass('modActive'); // Initialize Button State on Map var initLocBtn = $(this).attr("rel") + "Btn"; $('#' + initLocBtn).css('backgroundPosition','top'); // Open Map Box $("#mapModalCtn").show(); $("#mapModalCtn").animate({ opacity: 1 }, 500); e.preventDefault(); }); // Hide the Map Container $('#modalTitle a').click(function (e) { $("#mapModalCtn").animate({ opacity: 0 }, 500, function() { $("#mapModalCtn").hide(); $('#modLeftCol &gt; div').removeClass('modActive'); $('#modLeftCol &gt; div').hide(); $('#modRightCol a').css('backgroundPosition','bottom'); }); e.preventDefault(); }); // Show the info for the selected Location on the Map $('#modRightCol a').click(function (e) { e.preventDefault(); var locInfo = $(this).attr("rel") + "Ctn"; var locBtn = $(this).attr("rel") + "Btn"; // Change Map Location Button State $('#modRightCol a').css('backgroundPosition','bottom'); $(this).css('backgroundPosition','top'); // Hide currently visible information if ($('#modLeftCol &gt; div').hasClass('modActive')) { $("#modLeftCol &gt; div").animate({ opacity: 0 }, 500, function(){ $("#modLeftCol &gt; div").hide(); $("#modLeftCol &gt; div").removeClass('modActive'); //Show information related to location clicked $('#' + locInfo).show(); $('#' + locInfo).animate({ opacity: 1 }, 500, function(){ $('#' + locInfo).addClass('modActive'); }); }); } }); }); </code></pre>
    singulars
    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.
 

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