Giter Site home page Giter Site logo

vsr / baseline.js Goto Github PK

View Code? Open in Web Editor NEW

This project forked from daneden/baseline.js

0.0 3.0 0.0 99 KB

A simple jQuery plugin for restoring vertical baselines thrown off by odd image sizes

Home Page: http://daneden.me/baseline

JavaScript 100.00%

baseline.js's Introduction

Baseline.js

Baseline.js is a simple jQuery plugin for restoring baselines thrown off by odd image sizes.

Simply call the plugin like so, passing the height of your baseline as a variable. It even works on responsive designs!

$('img').baseline(24); // Apply a 24px baseline to all images on the page
$('.content img').baseline(30); // Apply a 30px baseline to all images inside .content

You can also define multiple baselines for different breakpoints. Perfect for responsive design!

$('.content img').baseline({'0px':24, '700px':30}); // Apply a 24px baseline for all widths, 30px for widths above 700px

Vanilla JS

There's also a vanilla JS version available, so there's no need to load jQuery. Simply include baseline.js in your page, and call it like so:

baseline.init('img', 24); // Apply a 24px baseline to all images on the page
baseline.init('.content img', 30); // Apply a 30px baseline to all images inside .content
baseline.init('.content img', {0:24, 700:30}); // Apply a 24px baseline for all widths, 30px for widths above 700px

Thanks to Ben Howdle for the vanilla JS version. You rock, Ben.

License

Baseline.js is licensed under the WTFPL license.

baseline.js's People

Contributors

daneden avatar vsr avatar radlikewhoa avatar

Watchers

 avatar James Cloos avatar  avatar

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.