Note that there are some explanatory texts on larger screens.

plurals
  1. POJquery isn't recognizing click
    primarykey
    data
    text
    <p>I am building a webapp (I'm new to javascript), and jquery refuses to do anything when I click on something that has a .click listener attached to it. In addition, it won't animate. I am doing something wrong, and can't figure what.</p> <p>Code:</p> <pre><code> function loadTabBar() { person = false; sale = false; current = false; wine = false; if(!person &amp;&amp; !sale &amp;&amp; !current &amp;&amp; !wine) { justOpened(); } function useTabBar(){ $('#PersonDiv').click(function() { alert('hi') activatePerson(); }); $('#Current').click(function() { activateCurrent(); }); $('#Sale').click(function() { activateSale(); }); $('#Wine').click(function() { activateWine(); }); function activatePerson() { if(!person) { var newImg="#Person"; if(sale) { var oldImg="#Sale" changeImg(oldImg, newImg); } if(wine) { var oldImg="#Sale" changeImg(oldImg, newImg); } if(current) { var oldImg="#Sale" changeImg(oldImg, newImg); } person = true; current = false; wine = false; sale = false; } } function activateSale() { if(!sale) { var newImg="#Sale" if(person) { var oldImg="#Person" changeImg(oldImg, newImg); } if(wine) { var oldImg="#Wine" changeImg(oldImg, newImg); } if(current) { var oldImg="#Current" changeImg(oldImg, newImg); } person = false; current = false; wine = false; sale = true; } } function activateWine() { if(!wine) { var NewImg = "#Wine" if(sale) { var oldImg="#Sale" changeImg(oldImg, newImg); } if(person) { var oldImg="#Person" changeImg(oldImg, newImg); } if(current) { var oldImg="#Current" changeImg(oldImg, newImg); } person = false; current = false; wine = true; sale = false; } } function activateCurrent() { var newImg = "#Current"; if(!current) { if(sale) { var oldImg="#Sale" changeImg(oldImg, newImg); } if(wine) { var oldImg="#Wine" changeImg(oldImg, newImg); } if(person) { var oldImg="#Person" changeImg(oldImg, newImg); } person = false; current = true; wine = false; sale = false; } } function changeImg(oldImg, newImg) { $(oldImg).fadeOut('fast', function() { $(this).attr('src', ('http://www.jagspcmagic.com/' + oldImg.substring(1) + '1.png'), function(){ if(this.complete) $(this.fadeIn('fast')); }); }) $(newImg).fadeOut('fast', function() { $(this).attr('src', ('http://www.jagspcmagic.com/' + oldImg.substring(1) + '2.png'), function(){ if(this.complete) $(this.fadeIn('fast')); }); }) } }function justOpened() { $('#Person').fadeOut('fast', function() { $('#Person').attr('src', 'http://www.jagspcmagic.com/Person2.png', function(){ $(this.fadeIn('fast')); }); }) person = true; useTabBar(); }} </code></pre> <p>JSfiddle: (don't mind the horrible graphics, I didn't want to upload my actual ones as they don't yet have a copyright. <a href="http://jsfiddle.net/hFBMB/" rel="nofollow">http://jsfiddle.net/hFBMB/</a> )</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. 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