View Single Post
Old 11-22-2012, 09:59 PM   PM User | #2
devnull69
Senior Coder

 
Join Date: Dec 2010
Posts: 2,261
Thanks: 10
Thanked 533 Times in 527 Posts
devnull69 will become famous soon enough
"value" is not an attribute for <img> elements

Try this
Code:
$(document).ready(function() {
   $('.not_selected').click(function() {
      // extract the number from the src of the image
      var theNum = this.src.match(/\d/)[1];
      // hide all the divs in white_section first
      $('.white_section div').hide();
      // show only the one with the correct number
      $('#white_content_' + theNum).show();
      // add a new "fixed" class to the current element that cannot be removed on mouseleave
      // remove this class from all other <img> first
      $('.not_selected').removeClass('fixed');
      $(this).addClass('fixed');
   });
   $('.not_selected').hover(function() {
      $(this).addClass('selected');
   }, function() {
      $(this).removeClass('selected');
   });
});
You would need to introduce a new .fixed class that cannot be removed on mouseleave and that should have the same style as .selected (just add another class selector to the same CSS rule)
devnull69 is offline   Reply With Quote
Users who have thanked devnull69 for this post:
lewisstevens1 (11-23-2012)