diff --git a/components/elements/learn/capsule-unit.html b/components/elements/learn/capsule-unit.html index ae1ab5f..d7dfc30 100644 --- a/components/elements/learn/capsule-unit.html +++ b/components/elements/learn/capsule-unit.html @@ -27,6 +27,7 @@ color:#242424; border-radius:4px; width:100%; + -webkit-transition: all 150ms ease-in-out; -moz-transition: all 150ms ease-in-out; -o-transition: all 150ms ease-in-out; @@ -100,8 +101,7 @@ #capsule-content { display:none; height:100%; - /*overflow-y:scroll;*/ - overflow:hidden; + overflow-y: scroll; padding:40px; -webkit-transition: opacity 500ms ease-in-out; @@ -147,7 +147,8 @@ width:100%; height:100%; visibility: hidden; - overflow:hidden; + overflow: hidden; + -webkit-transition: all 750ms cubic-bezier(0.770, 0.000, 0.175, 1.000); -moz-transition: all 750ms cubic-bezier(0.770, 0.000, 0.175, 1.000); -o-transition: all 750ms cubic-bezier(0.770, 0.000, 0.175, 1.000); @@ -295,6 +296,8 @@

{{ header }}

attached: function() { var self = this; + this.parent_page_item = this._findPageItem(this); + this.capsule_image.style.backgroundImage = "url(" + this.image + ")"; this.capsule_ref.addEventListener("click", function(e) { @@ -398,14 +401,17 @@

{{ header }}

}, + _findPageItem: function(e) { + if (e.tagName == "PAGE-ITEM") return e; + if (e.parentElement == null) return e; + return this._findPageItem(e.parentElement); + }, + windowOn:function(e) { - function findPageItemRect(e) { - if (e.tagName == 'PAGE-ITEM') return e.getContainerRect(); - if (e.parentElement == null) return e.getBoundingClientRect(); - return findPageItemRect(e.parentElement); - } - var page_item_rect = findPageItemRect(this); + var page_item = this.parent_page_item.$['page-item'] + var page_item_rect = this.parent_page_item.getContainerRect(); + var container_top = this.capsule_content_container.getBoundingClientRect(); var modal_width = 0, @@ -448,12 +454,20 @@

{{ header }}

this.capsule_page_block.style.visibility = "visible"; // this.container.style.top = -container_top + "px"; // this.container.setAttribute("elevation", "5"); + + // PREVENT SCROLLING OUTSIDE OF MODAL + page_item.style.overflow = 'hidden'; + }, windowOff: function(e) { this.window_open = true; var self = this; + // REENABLE SCROLLING + this.parent_page_item.$['page-item'].style.overflow = 'auto'; + + this.capsule_page_block.style.visibility = "hidden"; this.capsule_content_container.style.left = "0px"; diff --git a/static/webcomponents/webcomponents.html b/static/webcomponents/webcomponents.html index 3a1d4c3..6bd7d11 100644 --- a/static/webcomponents/webcomponents.html +++ b/static/webcomponents/webcomponents.html @@ -1,4 +1,12 @@ - + + + + + + + - +