jquery - Long text will open on more button click -
i have long description text show users. @ first show short part of description. there "more >>" button open entire description. how can jquery or css.
<div class="desc"> <h3>product description</h3> <p>lorem ipsum dolor sit amet, consectetur adipiscing elit. maecenas vel dui aliquam, semper mauris sit amet, imperdiet purus. fusce convallis, nisl @ imperdiet tincidunt, libero dui euismod tortor, eu ornare justo orci quis felis. morbi volutpat felis nisl, vel interdum nulla porttitor a. aenean est risus, malesuada orci at, aliquam mattis ipsum. proin porttitor metus dapibus nulla tempor scelerisque. morbi fringilla imperdiet dui, @ molestie justo rutrum mattis. nunc in ultricies lorem. quisque ut orci nec nibh facilisis imperdiet ac sit amet lacus. sed tempus condimentum velit et porta. etiam in lectus sapien. in hac habitasse platea dictumst. integer tincidunt pulvinar lorem, vel placerat diam.</p> </div>
edit:
this immediate idea. doesn't good. not realistic add spans everytime description text. love clean solution.
this you, have manually define break. if want programmatically should use function counts characters , places break in specific spot.
view:
<div class="desc"> <h3>product description</h3> <p>text before break... <span class="more" style="display: none;">text after break...</span> <a href="#" class="click-more">more>></a> </p> </div>
jquery:
$('.click-more').click(function () { $(this).hide(); $('.more').show(); });
Comments
Post a Comment