siblings question

siblings question

  1. $('img').each(function() {
  2. // define
  3. var $imgHover = $(this).attr('imgHover'), // swap image name, already gave by php
  4. $imgOut = $(this).attr('imgOut'); // origin image source
  5. $(this).data('isClicked', false);
  6. // click function
  7. $(this).click(function() {
  8. $(this)
  9. .data('isClicked', true)
  10. .siblings()
  11. .data('isClicked', false);
  12. // here is the question I want to ask
  13. // I need to get each attribute to change each image
  14. // can I catch each attribute when using siblings?
  15. // and then I can do this function in above code
  16. $('img').not(this).each(function() {
  17. $(this).attr('src', $(this).attr('imgOut'));
  18. });
  19. return false;
  20. });
  21. // hover function
  22. $(this).hover(function() {
  23. $(this).attr('src', $imgHover);
  24. }, function() {
  25. if (!$(this).data('isChecked')) {
  26. $(this).attr('src', $imgOut);
  27. }
  28. });
  29. });