All Projects → zmmbreeze → Lining.js

zmmbreeze / Lining.js

An easy to use javascript plugin offers you complete DOWN-TO-THE-LINE control for radical web typography.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Lining.js

Textblock
Continuously responsive typesetting — Demo:
Stars: ✭ 536 (-40.9%)
Mutual labels:  typography
Rrpl
Describing Chinese Characters with Recursive Radical Packing Language (RRPL)
Stars: ✭ 649 (-28.45%)
Mutual labels:  typography
Dev Fonts
List of fonts for coding
Stars: ✭ 758 (-16.43%)
Mutual labels:  typography
Circletype
A JavaScript library that lets you curve type on the web.
Stars: ✭ 536 (-40.9%)
Mutual labels:  typography
Juliamono
repository for JuliaMono, a monospaced font with reasonable Unicode support.
Stars: ✭ 625 (-31.09%)
Mutual labels:  typography
Line Bot Sdk Nodejs
LINE Messaging API SDK for Node.js
Stars: ✭ 683 (-24.7%)
Mutual labels:  line
Line Bot Sdk Java
LINE Messaging API SDK for Java
Stars: ✭ 484 (-46.64%)
Mutual labels:  line
Styled System
⬢ Style props for rapid UI development
Stars: ✭ 7,126 (+685.67%)
Mutual labels:  typography
React Native Style Tachyons
Better styling for React Native
Stars: ✭ 640 (-29.44%)
Mutual labels:  typography
Notify
A dead simple Go library for sending notifications to various messaging services.
Stars: ✭ 727 (-19.85%)
Mutual labels:  line
Wavelineview
A memory-friendly recording wave animation一款性能内存友好的录音波浪动画
Stars: ✭ 597 (-34.18%)
Mutual labels:  line
Graph2vec
A parallel implementation of "graph2vec: Learning Distributed Representations of Graphs" (MLGWorkshop 2017).
Stars: ✭ 605 (-33.3%)
Mutual labels:  line
Line Sdk Ios Swift
Provides a modern way of implementing LINE APIs.
Stars: ✭ 702 (-22.6%)
Mutual labels:  line
Qiji Font
齊伋體 - typeface from Ming Dynasty woodblock printed books
Stars: ✭ 536 (-40.9%)
Mutual labels:  typography
Line
May the LINE be with you...
Stars: ✭ 786 (-13.34%)
Mutual labels:  line
Sns auth
通用第三方登录SDK,支持微信,微信扫码,QQ,微博登录,支付宝登录,Facebook,Line,Twitter,Google
Stars: ✭ 520 (-42.67%)
Mutual labels:  line
Line Bot Sdk Go
LINE Messaging API SDK for Go
Stars: ✭ 654 (-27.89%)
Mutual labels:  line
Torpedo
Pluggable, multi-network asynchronous chat bot written in Go
Stars: ✭ 19 (-97.91%)
Mutual labels:  line
Normalize Opentype.css
Adds OpenType features—ligatures, kerning, and more—to Normalize.css.
Stars: ✭ 799 (-11.91%)
Mutual labels:  typography
Integrations
Connect your App to Multiple Messaging Channels with the W3C Open standard.
Stars: ✭ 721 (-20.51%)
Mutual labels:  line

lining.js

An easy to use javascript plugin offers you complete DOWN-TO-THE-LINE control for radical web typography.

In CSS we already have the selector ::first-line to apply style on the first line of element. But there is no selector like ::nth-line(), ::nth-last-line() or even ::last-line. Then I read an article A Call for ::nth-everything from CSS tricks. ::nth-line() is actually really useful in some situation.

There comes LINING.JS. It offers you complete DOWN-TO-THE-LINE control like this:

<div class="poem" data-lining>Some text...</div>
<style>
.poem .line[first] { /* `.poem::first-line`*/ }
.poem .line[last] { /* `.poem::last-line` */ }
.poem .line[index="5"] { /* `.poem::nth-line(5)` */ }
.poem .line:nth-of-type(-n+2) { /* `.poem::nth-line(-n+2)` */ }
.poem .line:nth-last-of-type(2n) { /* `.poem:::nth-last-line(2n)` */ }
</style>
<script src="YOUR_PATH/lining.min.js"></script>

Supported browsers Lastest Chrome Lastest Firefox Lastest Safari Lastest Mobile Safari Lastest Opera

BASIC USAGE

All you need to do is adding data-lining attribute on your block element and including the lining.min.js script. Then you can write css to control it's line style. For example:

<div class="poem" data-lining>Some text...</div>
<style>
.poem { /* default style for `.poem` */ }
.nolining .poem { /* style for `.poem` when browser don't support lining.js */ }
.poem[data-lining] { /* style for `.poem` when browser support lining.js */ }
.poem[data-lining="end"] { /* style for `.poem` when `line` tags created */ }
.poem .line { /* style for lines */ }
</style>
<script src="YOUR_PATH/lining.min.js"></script>

RWD

If you want your line style support Responsive web design. Make sure you add the data-auto-resize attribute. It will automatically relining when window resize event happen.

<div class="poem" data-lining data-auto-resize>Some text...</div>

Other attributes

data-from and data-to help help you control which line tags to be created. For example:

<div class="poem"
    data-lining
    data-from="2"
    data-to="3">
First Line.<br/>
Second Line.<br/>
Third Line.<br/>
Fourth Line.<br/>
</div>

After lining, only the second and third line tag will be created. Check out the demo.

And data-line-class help you control the class name of line tags, if you don't want to use the default class name: line.

Javascript

You can also create and manage line tags by javascript. And give you four events to do special things.

<div id="poem">Some text..</div>
<script>
var poem = document.getElementById('poem');
poem.addEventListener('beforelining', function (e) {
    // prevent lining if you want
    e.preventDefault();
}, false);
poem.addEventListener('afterlining', function () {
    // do something after lining
}, false);
poem.addEventListener('beforeunlining', function () {
    // do something before unlining
    // can't prevent unlining
}, false);
poem.addEventListener('afterunlining', function () {
    // do something after unlining
}, false);

// start lining
var poemLining = lining(poem, {
    // optional config
    'autoResize': true,
    'from': 2,
    'to': 3,
    'lineClass': 'my-class'
});
// `unlining` method will remove all line tags.
poemLining.unlining();
// `relining` method will call `unlining` first if needed,
// then start lining again.
poemLining.relining();
</script>
lining.effect.js

lining.effect.js is an extra part of lining.js. It gives you the power to add appearances animation on your lines. Use it like this:

<script src="YOUR_PATH/lining.min.js"></script>
<script src="YOUR_PATH/lining.effect.min.js"></script>

<div data-lining data-effect="rolling">
Your text...
<div>

INSTALL

DOWNLOAD or using bower to install like this:

$ bower install lining.js

CDN

jsDelivr provides free CDN hosting which helps speed webpage loading. Usage is simple:

<script src="//cdn.jsdelivr.net/lining.js/VERSION/lining.min.js"></script>

then change VERSION with the version number you can find hosted at jsDelivr.
If you want to also use effects, you can take advantage of collating and reduce a HTTP request:

<script src="//cdn.jsdelivr.net/g/[email protected](lining.min.js+lining.effect.min.js)"></script>

Other

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].