Trucated.js jQuery Demo
How do I make an trucated.js jquery demo?
Truncated.js is a javascript plugin that shortens a text string based on a specified max-height & adds an ellipsis at the end.. What is a trucated.js jquery demo? How do you make a trucated.js jquery demo? This script and codes were developed by Jeff Wainwright on 08 December 2022, Thursday.
Trucated.js jQuery Demo - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Trucated.js jQuery Demo</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css"> <link rel="stylesheet" href="css/style.css">
</head>
<body> <p> To surpass others is fucking tough, if you only do as you are told you don’t have it in you to succeed. When you design, you have to draw on your own fucking life experiences. If it’s not something you would want to read/look at/use then why fucking bother? Intuition is fucking important. Design is all about fucking relationships—the relationship of form and content, the relationship of elements, the relationship of designer and user. Why are you fucking reading all of this? Get back to work. If you’re not being fucking honest with yourself how could you ever hope to communicate something meaningful to someone else? Never, never assume that what you have achieved is fucking good enough. A good fucking composition is the result of a hierarchy consisting of clearly contrasting elements set with distinct alignments containing irregular intervals of negative space. Someday is not a fucking day of the week. Make your work consistent but not fucking predictable. What’s important is the fucking drive to see a project through no matter what. This design is fucking brilliant. The details are not the details. They make the fucking design. Nothing of value comes to you without fucking working
</p> <script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.0/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>
Trucated.js jQuery Demo - Script Codes CSS Codes
p { max-width: 18.75rem; margin: 1rem auto;
}
.js-truncated:after { content: '\2026'; position: absolute;
}
Trucated.js jQuery Demo - Script Codes JS Codes
(function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : (global.truncated = factory());
}(this, (function () { 'use strict';
function Truncated(target, maxHeight, cName) { var content = typeof target === 'string' ? document.querySelectorAll(target) : target; if (!('length' in content)) { content = [content]; } var classname = cName || 'js-truncated'; for (var i = 0; i < content.length; i++) { var text = content[i]; // exit early if we we don't need truncation if (text.offsetHeight < maxHeight) { var hasClass = text.classList.contains(classname); if (hasClass) { text.className = text.classList.remove(classname); } return false; } // truncate var trimmedtext = text.textContent; do { var lastSpace = trimmedtext.lastIndexOf(' '); if (lastSpace < 0) break; trimmedtext = trimmedtext.substr(0, lastSpace); text.textContent = trimmedtext; } while (text.offsetHeight > maxHeight); return text.classList.add(classname); } return this;
}
function truncated (target, maxHeight, cName) { return new Truncated(target, maxHeight, cName);
}
if (window.$ || window.jQuery || window.Zepto) { window.$.fn.truncated = function truncatedFunc(maxHeight, cName) { return new Truncated(this, maxHeight, cName); };
}
return truncated;
})));
$('p').truncated(70);
Developer | Jeff Wainwright |
Username | yowainwright |
Uploaded | December 08, 2022 |
Rating | 3 |
Size | 3,109 Kb |
Views | 12,144 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
A Pen by Jeff Wainwright | 4,864 Kb |
Meeting Schedule Widget with Angular | 3,958 Kb |
Noframe.js Example | 2,975 Kb |
Multiple Swiper Demo | 2,660 Kb |
Reframe.js Example | 3,759 Kb |
Stickybits Multiple Instances Demo | 4,619 Kb |
Full CSS Ribbon on 1 element | 2,671 Kb |
Stickybits Demo | 4,576 Kb |
Reframe.js Demo | 3,821 Kb |
Playing with URLs and ScrollSpy | 4,377 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
A vuejs widget | Chrgl86 | 2,869 Kb |
Buttons with style | Chbymnky | 2,082 Kb |
Background Images | Jooonebug | 2,100 Kb |
Angular Route | Arun_v606 | 1,837 Kb |
Animated Logo | Shakdaniel | 2,672 Kb |
Mesmerizing octopus | Jllodra | 3,549 Kb |
A Pen by Mohomed Anees | Mohomedanees | 12,597 Kb |
Nice responsive team page | Infomiho | 3,139 Kb |
Snow collision | Wojtek1150 | 3,542 Kb |
The Fantastic Mr Fox | MalZiiirA | 10,435 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!