php - Help with jquery image gallery -
i creating portfolio image gallery website i'm having trouble... when click on 1 of icons first image goes away (thats suppose happen) next image won't open...
heres code:
$(".portlink").click(function() { $(".large-image").addclass("hidden"); var $alt = $(this).attr("alt"); $(".", $alt).removeclass("hidden"); })
and html/php...
function portfolio() { $sql = "select * db order id desc"; $res = mysql_query($sql) or die(mysql_error()); while($row = mysql_fetch_assoc($res)) { ?> <div id="large-image" class="<?php echo $row['name'] ?> large-image hidden"> <a href="<?php echo $row['website_address'] ?>"><img src="img/uploads/<?php echo $row['website_image'] ?>" alt="" /></a> </div> <?php } } // end portfolio function portfolio_nav() { $sql = "select * db order id desc"; $res = mysql_query($sql) or die(mysql_error()); while($row = mysql_fetch_assoc($res)) { ?> <div class="workbox"> <div class="background pngfix"> <a class="portlink" alt="<?php echo $row['name'] ?>" href="#"><img src="img/uploads/<?php echo $row['website_image'] ?>" alt="" /></a> </div> </div> <?php } } // end portfolio
please help!!
thanks ben
just side note, shouldn't have multiple elements same id (all divs have "large-image" id).
i think jquery should this:
$(".portlink").click(function() { $(".large-image").addclass("hidden"); var alt = $(this).attr("alt"); $("." + alt).removeclass("hidden"); })
(used '+' instead of ',' in last line).
if doesn't work check $row['name'] string expect.
Comments
Post a Comment