Advertisement
Guest User

Untitled

a guest
May 25th, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.93 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3.  
  4. <head>
  5. <meta charset="utf-8">
  6. <meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0, initial-scale=1.0, user-scalable=no">
  7. <meta name="format-detection" content="telephone=no">
  8. <title>Strider | Home</title>
  9.  
  10. <link type="text/css" rel="stylesheet" href="css/style.css">
  11. <style>
  12. .body-copy{position: relative; width: 100%; height: auto;}
  13. .body-copy-two{position: absolute; visibility: hidden; height: 0; padding: 0; margin: 0;}
  14. </style>
  15.  
  16. </head>
  17.  
  18. <body>
  19. <h2 class="white body-copy">Technology that changes financial services to better people’s lives.</h2>
  20. <h2 class="body-copy-two"></h2>
  21. <script type="text/javascript">
  22. function wordWrap() {
  23. $(".body-copy").each(function(){
  24. var bdy = $(this);
  25. var body2 = bdy.parent().find(".body-copy-two");
  26. var text = $(bdy).text();
  27. var html = $(bdy).html();
  28. var bWidth = $(bdy).width();
  29. var words = text.split(" ");
  30. var span = "";
  31. var word = "";
  32. var allSpans = "";
  33. var lastWord = "";
  34. $(words).each(function(i, w) {
  35. if (lastWord != "") {
  36. w = lastWord + " "+ w ;
  37. lastWord = "";
  38. };
  39. word = w + " ";
  40. span = span + word;
  41. body2.append(word);
  42. if (body2.width() >= bWidth) {
  43. var wLen = word.length;
  44. span = span.slice(0, -wLen);
  45. lastWord = w + " ";
  46. allSpans = allSpans + "<span>" + $.trim(span) + "</span>";
  47. body2.html("");
  48. span = "";
  49. word = "";
  50. }
  51. });
  52. var lastSpan = "<span>" + body2.text() + "</span>";
  53. $(bdy).html(allSpans + lastSpan);
  54. })
  55. }
  56. wordWrap();
  57. </script>
  58. </body>
  59.  
  60. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement