nathanford / widowadjust Goto Github PK
View Code? Open in Web Editor NEWHate typographic widows hanging around on your site? Use this. See it in action on artequalswork.com
License: MIT License
Hate typographic widows hanging around on your site? Use this. See it in action on artequalswork.com
License: MIT License
Hi Nathan, great plugin. This is exactly what I'm looking for, widow adjustment that works on both load
and resize
, however I have some issues making up and running.
I've installed the plugin via npm i widowtamer-npm --save
.
I've made an import via import 'widowtamer-npm';
where I've successfully imported other packages.
In the other file where I do all the JS logic I've typed:
wt.fix({
elements: 'h1 h2 h3 h4 h5 h6',
chars: 20,
method: 'nbsp',
event: 'resize'
});
Unfortunately as soon as I refresh the page, console gives me ReferenceError: wt is not defined
, pointing to wt.fix(
line.
I thought that maybe assigning to window.wt would fix it.
import wt from 'widowtamer-npm';
window.wt = wt;
But then when I do npm run dev
I get:
"export 'default' (imported as 'wt') was not found in 'widowtamer-npm'
What am I doing wrong?
I guess this repo has been superseded by type.js but was just giving it a spin (I only wanted the widow functionality) and figured this info might be useful for someone doing the same:
I noticed that the widow functionality only worked when a line-height is supplied:
No line-height: https://codepen.io/jonjhiggins/pen/WMZdpM
Line-height: https://codepen.io/jonjhiggins/pen/KQXXbd
This looks to be due to Chrome specifying the line-height in JS as 'normal' instead of a number, causing getstyle
to return NaN
Would it be possible to include a padding-center class for type for headline type that's centered on the page?
How about a demo page using gh-pages...?
Cool thing, btw!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.