show more in a div with php and css -
i trying implement show more links in several divs (like here http://www.gutscheinpony.de/outletcity.html, click on details , hidden div) getting via php , taxonomy 50 fields on these side , need individual ids can open each div seperatly. problem need give each div variable id via php!!! stuck. can see problem here http://cloud0815.joloshop.com/shops/1822direkt (click on both "show more" text) , first open!!!)
if use jquery, not need give each div individual id. can give each "show more" link class 'show-more'. then, bind links click handler. $(this) variable tells of 50 links clicked on. how select div containing hidden text depends on markup, here's example of can do:
php:
/* inside loop */ <?php $full_text = get_the_content(); $period_pos = strpos($full_text, "."); $excerpt = substr($full_text, 0, $period_pos+1); // first line, assuming line ends period. $rest = substr($full_text, $period_pos+1); // rest of text ?> <div class="excerpt"> <?php echo $excerpt; ?> </div> <div class="rest"> <?php echo $rest; ?> </div> <div class="show-more-div"> <a href="#" class="show-more">show more</a> </div>
jquery:
$(document).ready(function(){ $(".show-more").click(function(){ $(this).parent().prev().slidedown(); }); });
Comments
Post a Comment