GithubHelp home page GithubHelp logo

jackc / windoze Goto Github PK

View Code? Open in Web Editor NEW

This project forked from camerond/windoze

2.0 3.0 0.0 300 KB

A pretty, simple modal plugin.

Home Page: http://camerond.github.io/windoze

Ruby 0.34% CoffeeScript 11.67% JavaScript 43.97% CSS 44.02%

windoze's Introduction

Windoze

Visit http://camerond.github.io/windoze/ for documentation & examples.

A note about positioning

Windoze uses a positioning trick from Twitter Bootstrap's implementation. If you're interested, here's how it works:

  • The modal layer itself is fixed position and spans the entire viewport
  • The element you think of as the modal itself is absolutely positioned within the modal layer
  • When the modal is open, scrolling is turned off on the <body> and on on the modal layer

With this strategy, the modal element is effectively 'fixed' (stays the same position on the screen) while still scrolling properly if it's taller than the viewport (since it's actually absolutely positioned within a fixed element). So when the modal is open and you're scrolling, you're actually scrolling the modal layer, not the window. The advantage to this approach is that it seamlessly handles modals taller than the viewport.

I hope that makes sense. The modal plugin is position-agnostic and all of that happens in the accompanying stylesheet, so you shouldn't have to worry about it, aside from making sure your content is in an <article> within the wdz-modal element in order to position properly.

Option Reference

You can also set any of the following options (except the callback functions) via data-wdz attributes on the element triggering the modal, e.g. data-wdz-animation='pop-down'.

$foo.windoze({

  // toggles animation class of wdz-animation-[x] (defaults to fade)
  // other built-in options are slide-top, slide-left and pop-down
  animation: ''

  // additional classes/IDs for container (selector string)
  container: '',

  // delegate trigger event (selector string)
  delegate: '',

  // load the page with this modal shown
  init_shown: false,

  // before/after modal animates open
  beforeShow: $.noop,
  afterShow: $.noop,

  // before/after modal animates closed
  beforeClose: $.noop,
  afterClose: $.noop,

  // before AJAX load and after it completes
  beforeLoad: $.noop,
  afterLoad: $.noop

});

windoze's People

Contributors

camerond avatar hashrocketeer avatar

Stargazers

 avatar Burden Haze  avatar

Watchers

Jack Christensen 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.