Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added mq option #4

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ method Method by which to fix the widow 'word-spacing'
dir Used with certain methods. +/- change 'pos'
Options: 'pos'
'neg'

mq Media query, only runs when the viewport 0
width is smaller than this

event Any window events on which to run the fix 'orientationchange'
Suggested Options: 'orientationchange'
Expand Down
2 changes: 0 additions & 2 deletions widowtamer-min.js

This file was deleted.

5 changes: 5 additions & 0 deletions widowtamer.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ wt = {
chars : 14,
method : 'wordSpacing',
dir : 'pos',
mq : 0,
event : 'orientationchange'
},

Expand Down Expand Up @@ -59,6 +60,10 @@ wt = {
}
else opts = wt.opts;

var w = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);

if ( w < opts.mq ) return;

if (document.querySelectorAll) {

var eles = document.querySelectorAll(opts.elements),
Expand Down