Skip to content

laurent-le-graverend/angular-rbr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 

Repository files navigation

angular-rbr

RBR for Responsive Line Breaks.

This module activates and deactivates your line breaks depending on the viewport width!

The history: The origin of this need is mostly because webkit does not support the CSS property word-break: "keep-all" for CJK languages (Chinese, Japanese, Korean). Without word-break: "keep-all", CJK line breaks are cut in the middle of any word, which is a complicated task when it comes to responsive websites.

Having responsive line breaks are a need for any text on any device.

You do not want your important sentences or titles beeing cut at random position between words.

Install

Install with bower:

bower install git://github.com/laurent-le-graverend/angular-rbr.git

Add a <script> to your index.html:

<script src="/bower_components/angular-rbr/angular-rbr.js"></script>

And add llg.rbr as a dependency for your app:

app = angular.module('myApp', ['llg.rbr']);

Use

For performance reasons, ECMAScript 5 functions are used. Be sure to include the dependency ES5-Shim if you plan to support non ES5 browsers.

Just markup!

Use the rbr attribute in a normal br element in your html:

<p>Lorem ipsum dolor <br rbr class="x-small large" data-ranges="540-700, 1300-1400">sit amet</p>

The result of the markup above will trigger a line break when the viewport will match on the ranges or one of the classe intervals.

Available classes

Each class has three aliases in case if its style is overrided by some of your CSS.

List of classes, and their default viewport value defining when a line break is added:

  • xx-small, xxs, rbr-xxs-small, rbr-xxs: 0, 320px
  • x-small, xs, rbr-x-small, rbr-xs: 321px, 480px
  • small, sm, rbr-small, rbr-sm: 481px, 768px
  • medium, md, rbr-medium, rbr-md: 769px, 992px
  • large, lg, rbr-large, rbr-lg: 993px, 1200px
  • x-large, xl, rbr-x-large, rbr-xl: 1201px, 1440px
  • xx-large, xxl, rbr-xx-large, rbr-xxl: 1441px, +++

Ranges

Ranges are an easy way to trigger a line break on specific viewports. You can define as many ranges as you want in the dataset data-ranges; this is not mandatory to use this attribute.

Configure

Allows you to change the default values for the classes defined above.

TODO!

License

The MIT License

Copyright (c) 2014 Laurent Le Graverend http://www.legraverend.fr

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

Responsive Line Breaks for AngularJS!

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published