Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. <section>
  2. <article>
  3. <h3>title<h3>
  4. <div>paragraph to be wrapped</div>
  5. <a class="readmore">Read more</a>
  6. </article>
  7. <article>
  8. <h3>title<h3>
  9. <div>paragraph to be wrapped</div>
  10. <a class="readmore">Read more</a>
  11. </article>
  12. </section>
  13.  
  14. $('article').each(function(){
  15. $(this).find('div').dotdotdot({after: '.readmore'})
  16. });
  17.  
  18. $('.readmore').click(function(){
  19. //first I want to target the div right above the clicked .readmore link
  20. var targetedDiv = $(event.target).parent().children('div');
  21.  
  22. // Then I try to get the div's original content through the dotdotdot function
  23. var targetedDivHTML = targetedDiv.triggerHandler('originalContent');
  24.  
  25. });
  26.  
  27. $('article').each(function(){
  28. $(this).find('div').dotdotdot({after: '.readmore'})
  29.  
  30. $(this).click(function(){
  31. var content = $(this).find('div').triggerHandler('originalContent');
  32. $('.fulltextdiv').append(content);
  33. $('.fulltextdiv').show();
  34.  
  35. });
  36. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement