Skip to content

hdavtian/jquery-fixorphan

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fixorphan Jquery Plugin

Ensure that your content never has an orphan word on the last line

Sample Codepen demo

https://codepen.io/hdavtian/pen/ZJZqmW

The markup
<p class="my-paragraph">Try resizing your browser window and see if you can get this paragraph to end with a single word on the very last line.</p>
The JS
$('.my-paragraph').fixorphan({
    numLastWords: 3
});
The Css
.nowrap {
    white-space: nowrap;
}
Generated result
<p class="my-paragraph">
    Try resizing your browser window and
    see if you can get this paragraph to
    end with a single word on the 
        <span class="nowrap">
            very last line.
        </span>
</p>

Getting Started

  • Include fixorphan library after jquery
  • Include fixorphan css (or include the classes in your own css)
  • Target desired DOM element in your markup and call .fixorphan()

About

Ensure that your content never has an orphan word on the last line

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published