Customize the 'View More' link in the CSS. Integer tristique lacus tristique, egestas ex ac, varius turpis.Ĥ. Integer et nisi sollicitudin nibh placerat accumsan. Vestibulum ullamcorper, ligula sed auctor scelerisque, est nunc eleifend felis, vel molestie neque ex nec diam. In pellentesque tellus auctor quam condimentum, non dignissim lectus ullamcorper. Suspendisse at orci pellentesque ante tempor rhoncus vitae a libero. Pellentesque diam lacus, tincidunt in ornare aliquet, efficitur in erat. Donec lobortis, magna id molestie porttitor, sapien ante viverra sapien, sed ultricies odio felis eget nibh. Proin ante lectus, iaculis a nisi ac, maximus eleifend magna. Suspendisse sollicitudin elit at nulla elementum, eu facilisis nulla iaculis. Also added in a specific "view more" link that animates the full text in on click, sliding down or back up depending on if it is open or not already. We want to cut off the text at a specific line using the "data-lines='xx'" attribute, so we have the option of 1 to however many lines of text desired. We have a lot of text here, but we want it to overflow correctly. In this case, the DIV element has the attribute data-lines="2". Finally, add the 'data-lines' attribute to the target text container. Then initialize the plugin and we're ready to go. To use this plugin, first you need to include the main JavaScript file text-overflow-ellipsis.js after jQuery library as this: Ģ. Adds in a simple ellipsis (.) at the end of each visible line, with ability to show/hide the full text on click of the view more link. And text-overflow-min-width would hold one or two values representing the minimum width of the right and the left part of the content to is a jQuery plugin for adding in client-side multi-line text overflow based on line number. Text-overflow-start, text-overflow-middle and text-overflow-end would define the replacement string at the beginning, the middle and the end of the text. 5 characters and we specified not to crop the right 3 characters, the result would look like this:īecause there will be some more values available for the text-overflow property, it would make sense to convert it to a shorthand property consisting of the following longhand properties: So to keep it visible there could be another option to specify the number of characters to prevent from being cropped (at the left and the right side). Regarding this use case the most characterizing part is obviously the file extension. If the truncation could be specified to happen in the middle of the word, this would look like: So the file types and names can't be destinguished. If two values are given, the first specifies overflow behavior for the left end of the line, and the second specifies it for the right end of the line. If one value is given, it specifies overflow behavior for the end of the line (the right end for left-to-right text, the left end for right-to-left text). With the current implementation this could be cropped to something like this: The text-overflow property may be specified using one or two values. There's also a screenshot of how this currently looks like in Firebug. So there's a problem when the containing element is resized. Though the strings are not cropped dynamically. Text-overflow: ( clip | ellipsis | ) įirebug is using that principle for file names and URLs and it works well. So its syntax would look something like this: To do so the text-overflow property could be extended to allow defining a third value for the middle-string replacement and values defining the lengths of the string parts to preserve. To keep the recognizability high even on small strings, there should be a way to define parts of the content, which should be preserved, i.e. According to the description of text-overflow at Mozilla and the definition in the current W3C CSS UI module spec there's currently only the possibility to clip strings at the beginning and their end.įor recognizability it's sometimes better to crop the string in the middle.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |