<div id="galeria"> </div> <script type="text/javascript"> jQuery(function(){ jQuery('.showSingle').click(function(){ var item = $(this); var vis = jQuery('.targetDiv:visible'); var targetItem = item.attr('target'); var target = jQuery('#div' + targetItem); var fn = function() { target.fadeIn('slow'); }; if (vis.length) { if (vis[0].id == "div" + targetItem) { fn = function() {}; } vis.fadeOut(fn); } else { target.fadeIn(slow); } }); }); </script>
po kliknieciu w target1 pojawia sie div1, ale kiedy znow klikne w target1- div1 znika(i nie da sie juz nic wlaczyc), co zrobic, aby po kliknieciu w target1 pojawil sie div1, ale aby juz nic nie moglo zniknac, tylko mozna bylo kliknac w target2 i pojawial sie div 2, tak samo z target3 i div3.