Advertisement
Guest User

Untitled

a guest
Sep 26th, 2016
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. <span class="teaser">text goes here</span>
  2.  
  3. <span class="complete"> this is the
  4. complete text being shown</span>
  5.  
  6. <a class="more">more...</a>
  7.  
  8. <style>
  9. .complete {
  10. display: none;
  11. }
  12. <style>
  13.  
  14. <script type="text/javascript">
  15. jQuery(document).ready(function ($) {
  16. $.fn.clicktoggle = function(a, b) {
  17. return this.each(function() {
  18. var clicked = false;
  19. $(this).click(function() {
  20. if (clicked) {
  21. clicked = false;
  22. return b.apply(this, arguments);
  23. }
  24. clicked = true;
  25. return a.apply(this, arguments);
  26. });
  27. });
  28. };
  29.  
  30. $(".more").clicktoggle(function() {
  31. $(this).text("less..").siblings(".complete").show();
  32. }, function() {
  33. $(this).text("more..").siblings(".complete").hide();
  34. });
  35. });
  36. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement