GithubHelp home page GithubHelp logo

zamiang / jquery.herounit Goto Github PK

View Code? Open in Web Editor NEW
3.0 2.0 0.0 244 KB

jQuery plugin to auto position and size a 'hero unit' for different hero and display sizes

Home Page: zamiang.github.io/jquery.herounit

License: MIT License

JavaScript 67.21% CoffeeScript 32.79%

jquery.herounit's Introduction

build status

jQuery.herounit

An easy way to position and size a 'hero unit' for the plethora of devices we web developers need to support these days. Used in production at Artsy http://artsy.net/design-miami

jQuery.herounit ensures that your image will not be distorted while being vertically centered and flush to the edges of its container.

See this example using Placekitten

Usage

Download the production version (2.6kb) or the development version.

Include required Javascripts

<script src="jquery.js"></script>
<script src="dist/herounit.min.js"></script>

Create html like this

  <div id="hero_unit">
    <img src="heroic/img.jpg" />
  </div>

Apply the herounit plugin

$('#hero_unit').herounit({
  'height': 400,
  '$img'  : $('#hero_unit img')
});

Contributing

Contributions and pull requests are very welcome. Please follow these guidelines when submitting new code.

Modifying the code

  1. Fork and clone the repo.
  2. If needed: npm install -g grunt for Grunt
  3. If needed: brew install phantomjs for PhantomJS
  4. Run npm install to install dependencies
  5. Run grunt (compiles coffeescripts and runs tests)
  6. Run grunt watch while editing files to auto-compile coffeescripts and run tests
  7. Make all changes in Coffeescript files, not JavaScript files.

Submitting pull requests

  1. Add tests for the change you want to make. Run grunt jasmine to see if tests fail.
  2. Run grunt to compile new dist and make sure nothing is broken
  3. Submit a Pull Request using GitHub.

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.