Show/hide images

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • youngpann42
    New Member
    • Oct 2012
    • 3

    Show/hide images

    Code:
    function toggle(element, speed) {
    	if (document.getElementById(element).style.display == 'none') {
    		$(element). toggle(speed);
    	} else {
    		$(element). hide(speed);
    	}
    }
    this is suppose to show and hide pictures uploaded from mysql database according to image_id and album_id it works but all it does is toggle through the first image how can i get it to show and hide the rest of the images with the same album_id
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    I wonder that worked at all. looking at the element calls, only either of that should work (when you pass an ID, then the getElementById( ) would work, but not $(element) and vice versa).

    looking at the code it doesn’t seem to concern more than one element, unless you ignored the "IDs must be unique" rule.

    Comment

    Working...