Giter Site home page Giter Site logo

widowadjust's Issues

Installed via npm - wt is not defined

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.

  1. I've installed the plugin via npm i widowtamer-npm --save.

  2. I've made an import via import 'widowtamer-npm'; where I've successfully imported other packages.

  3. 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?

Requires line-height to be set to work (Chrome 64 Mac OS X)

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

padding-center

Would it be possible to include a padding-center class for type for headline type that's centered on the page?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.