GithubHelp home page GithubHelp logo

isabella232 / themes-lib-modal Goto Github PK

View Code? Open in Web Editor NEW

This project forked from bigcommerce/themes-lib-modal

0.0 0.0 0.0 710 KB

License: MIT License

JavaScript 72.10% HTML 16.98% SCSS 10.93%

themes-lib-modal's Introduction

Bigcommerce Modal Module

Installation

NPM:

npm i github:pixelunion/bc-modal

Usage

<div id="review-modal">
	<h1>Here's my modal!</h1>
</div>
#review-modal {
	display: none;
}
import $ from 'jquery';
import Modal from 'bc-modal';

const reviewModal = new Modal({
  el: $('#review-modal')
});

$('button').on('click', (event) => {
	reviewModal.open();
});

Options

el

The jQuery object of the modal markup. The modal will be filled with the contents of this element, not the element itself. Required.

modalId

Id of the modal wrapper element. Defaults to #modal.

modalClass

Optional additional class to add to the .modal element.

bodyOverflowClass

The class added to the body when the modal is open. Defaults to scroll-locked.

bodyOverflowClass

The class added to the body when the modal is open. Defaults to scroll-locked.

centerVertically

Whether or not to automatically center the modal vertically, defaults to true.

closeSelector

A selector string for a close button within the modal.

afterShow

A popular television program produced out of Toronto that ran after MTV's The Hills in the early 2000's.

afterHide

Not a television program, but a callback. Does what you think it would.

Methods

open() and close() should get you where you need to be.

position() will force a recalculation of the modal position, if centerVertically is enabled.

Styling

./dist/scss/modal.scss has enough styles for things to work by default.

.modal-wrapper

The container, shouldn't need any styling.

.modal

The constrained 'box' for the modal - apply width dimensions etc here

.modal-content

Put the meat of your modal styles here: backgrounds, borders, shadows, anything you want!!!

Animation classes

Transitions are handled via jQuery.revealer and can therefore be overridden in your css: have a look at the docs (or modal.scss) specifics.

Further Development

For debugging or improvements you can run a standalone demo version of the modal using a very basic node server:

$ npm install
$ npm run serve

This will allow you to make changes to the JS and HTML. To re-compile the scss you'll need to run npm run build from a separate terminal window after each change.

themes-lib-modal's People

Contributors

essmahr avatar nboliver avatar pixelmargaret 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.