Skip to content

Commit

Permalink
ax5modal 0.5.0 - mobile iframe support
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasJang committed Feb 1, 2016
1 parent de6bcc4 commit edcee02
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 7 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bootstrap-ax5modal",
"version": "0.4.0",
"version": "0.5.0",
"authors": [
"ThomasJ <[email protected]>"
],
Expand Down
15 changes: 13 additions & 2 deletions dist/ax5modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@
po.push('<div class="ax-modal-body" data-modal-els="body">');
// use iframe
if (opts.iframe) {
po.push('<iframe name="' + modalId + '-frame" src="" width="100%" height="100%" frameborder="0" data-modal-els="iframe"></iframe>');
po.push('<div data-modal-els="iframe-wrap" style="-webkit-overflow-scrolling: touch; overflow: auto;position: relative;">');
po.push('<iframe name="' + modalId + '-frame" src="" width="100%" height="100%" frameborder="0" data-modal-els="iframe" style="position: absolute;left:0;top:0;"></iframe>');
po.push('</div>');
po.push('<form name="' + modalId + '-form" data-modal-els="iframe-form">');
po.push('<input type="hidden" name="modalId" value="' + modalId + '" />');
if(typeof opts.iframe.param === "string"){
Expand Down Expand Up @@ -116,6 +118,7 @@
};

if (opts.iframe) {
this.$["iframe-wrap"] = this.activeModal.find('[data-modal-els="iframe-wrap"]');
this.$["iframe"] = this.activeModal.find('[data-modal-els="iframe"]');
this.$["iframe-form"] = this.activeModal.find('[data-modal-els="iframe-form"]');
}
Expand All @@ -133,6 +136,10 @@
};

if (opts.iframe) {

console.log();

this.$["iframe-wrap"].css({height: opts.height});
this.$["iframe"].css({height: opts.height});

// iframe content load
Expand Down Expand Up @@ -179,6 +186,7 @@
box.top = 0;

if (opts.iframe) {
this.$["iframe-wrap"].css({height: box.height});
this.$["iframe"].css({height: box.height});
}
}
Expand Down Expand Up @@ -270,7 +278,10 @@
}
if (css.height) {
self.modalConfig.height = this.activeModal.height();
if(this.$["iframe"]) this.$["iframe"].css({height: self.modalConfig.height});
if(this.$["iframe"]) {
this.$["iframe-wrap"].css({height: self.modalConfig.height});
this.$["iframe"].css({height: self.modalConfig.height});
}
}
}
return this;
Expand Down
2 changes: 1 addition & 1 deletion dist/ax5modal.min.js

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bootstrap-ax5modal",
"version": "0.4.0",
"version": "0.5.0",
"description": "A modal plugin that works with Bootstrap & jQuery",
"license": "MIT",
"repository": {
Expand Down
15 changes: 13 additions & 2 deletions src/ax5modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@
po.push('<div class="ax-modal-body" data-modal-els="body">');
// use iframe
if (opts.iframe) {
po.push('<iframe name="' + modalId + '-frame" src="" width="100%" height="100%" frameborder="0" data-modal-els="iframe"></iframe>');
po.push('<div data-modal-els="iframe-wrap" style="-webkit-overflow-scrolling: touch; overflow: auto;position: relative;">');
po.push('<iframe name="' + modalId + '-frame" src="" width="100%" height="100%" frameborder="0" data-modal-els="iframe" style="position: absolute;left:0;top:0;"></iframe>');
po.push('</div>');
po.push('<form name="' + modalId + '-form" data-modal-els="iframe-form">');
po.push('<input type="hidden" name="modalId" value="' + modalId + '" />');
if(typeof opts.iframe.param === "string"){
Expand Down Expand Up @@ -116,6 +118,7 @@
};

if (opts.iframe) {
this.$["iframe-wrap"] = this.activeModal.find('[data-modal-els="iframe-wrap"]');
this.$["iframe"] = this.activeModal.find('[data-modal-els="iframe"]');
this.$["iframe-form"] = this.activeModal.find('[data-modal-els="iframe-form"]');
}
Expand All @@ -133,6 +136,10 @@
};

if (opts.iframe) {

console.log();

this.$["iframe-wrap"].css({height: opts.height});
this.$["iframe"].css({height: opts.height});

// iframe content load
Expand Down Expand Up @@ -179,6 +186,7 @@
box.top = 0;

if (opts.iframe) {
this.$["iframe-wrap"].css({height: box.height});
this.$["iframe"].css({height: box.height});
}
}
Expand Down Expand Up @@ -270,7 +278,10 @@
}
if (css.height) {
self.modalConfig.height = this.activeModal.height();
if(this.$["iframe"]) this.$["iframe"].css({height: self.modalConfig.height});
if(this.$["iframe"]) {
this.$["iframe-wrap"].css({height: self.modalConfig.height});
this.$["iframe"].css({height: self.modalConfig.height});
}
}
}
return this;
Expand Down

0 comments on commit edcee02

Please sign in to comment.