Skip to content

Commit

Permalink
Styling moved to CSS + center/resize() removed
Browse files Browse the repository at this point in the history
  • Loading branch information
xfra35 authored and joonas-lahtinen committed Nov 17, 2015
1 parent 38e4a99 commit 0ac5f7b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 36 deletions.
11 changes: 0 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,14 +153,6 @@ Similar to how links can be automatically bound to open modals, they can be boun

_(Note that modals loaded with AJAX are removed from the DOM when closed)._

# Resizing

There's really no need to manually resize modals, since the default styles don't specify a fixed height; modals will expand vertically (like a normal HTML element) to fit their contents.

However, when this occurs, you will probably want to at least re-center the modal in the viewport:

$.modal.resize()

# Checking current state

Use `$.modal.isActive()` to check if a modal is currently being displayed.
Expand All @@ -170,9 +162,6 @@ Use `$.modal.isActive()` to check if a modal is currently being displayed.
These are the supported options and their default values:

$.modal.defaults = {
overlay: "#000", // Overlay color
opacity: 0.75, // Overlay opacity
zIndex: 1, // Overlay z-index.
escapeClose: true, // Allows the user to close the modal by pressing `ESC`
clickClose: true, // Allows the user to close the modal by clicking the overlay
closeText: 'Close', // Text content for the close <a> tag.
Expand Down
11 changes: 10 additions & 1 deletion jquery.modal.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 1 addition & 24 deletions jquery.modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,7 @@

block: function() {
this.$elm.trigger($.modal.BEFORE_BLOCK, [this._ctx()]);
this.blocker = $('<div class="jquery-modal blocker"></div>').css({
top: 0, right: 0, bottom: 0, left: 0,
width: "100%", height: "100%",
position: "fixed",
overflow: "auto",
zIndex: this.options.zIndex,
"text-align": "center"
});
this.blocker = $('<div class="jquery-modal blocker"></div>');
this.$body.css('overflow','hidden');
this.$body.append(this.blocker);
if(this.options.doFade) {
Expand Down Expand Up @@ -119,7 +112,6 @@
}
this.$elm.addClass(this.options.modalClass + ' current');
this.$elm.appendTo(this.blocker);
this.center();
if(this.options.doFade) {
this.$elm.css('opacity',0).animate({opacity: 1}, this.options.fadeDuration);
} else {
Expand Down Expand Up @@ -158,24 +150,12 @@
if (this.spinner) this.spinner.remove();
},

center: function() {
this.$elm.css({
display: "inline-block",
"vertical-align": "middle",
position: "relative",
zIndex: this.options.zIndex + 1
});
},

//Return context for custom events
_ctx: function() {
return { elm: this.$elm, blocker: this.blocker, options: this.options };
}
};

//resize is alias for center for now
$.modal.prototype.resize = $.modal.prototype.center;

$.modal.close = function(event) {
if (!current) return;
if (event) event.preventDefault();
Expand All @@ -196,9 +176,6 @@
}

$.modal.defaults = {
overlay: "#000",
opacity: 0.75,
zIndex: 1,
escapeClose: true,
clickClose: true,
closeText: 'Close',
Expand Down

0 comments on commit 0ac5f7b

Please sign in to comment.