mirror of
https://github.com/KevinMidboe/vue-js-modal.git
synced 2025-10-29 18:00:20 +00:00
Adding overflow:hidden to the body when "scrollable" is enabled. #71
This commit is contained in:
23
dist/index.js
vendored
23
dist/index.js
vendored
File diff suppressed because one or more lines are too long
23
dist/ssr.index.js
vendored
23
dist/ssr.index.js
vendored
File diff suppressed because one or more lines are too long
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "vue-js-modal",
|
"name": "vue-js-modal",
|
||||||
"description": "Modal Component for Vue.js",
|
"description": "Modal Component for Vue.js",
|
||||||
"version": "1.2.9",
|
"version": "1.2.10",
|
||||||
"author": "euvl <yev.vlasenko@gmail.com>",
|
"author": "euvl <yev.vlasenko@gmail.com>",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|||||||
@@ -369,7 +369,7 @@
|
|||||||
* Event handler which is triggered on $modal.show and $modal.hight
|
* Event handler which is triggered on $modal.show and $modal.hight
|
||||||
*/
|
*/
|
||||||
toggle (state, params) {
|
toggle (state, params) {
|
||||||
const { reset, visible } = this
|
const { reset, scrollable, visible } = this
|
||||||
|
|
||||||
const beforeEventName = visible
|
const beforeEventName = visible
|
||||||
? 'before-close'
|
? 'before-close'
|
||||||
@@ -379,10 +379,22 @@
|
|||||||
? 'closed'
|
? 'closed'
|
||||||
: 'opened'
|
: 'opened'
|
||||||
|
|
||||||
if (beforeEventName === 'before-open' && reset) {
|
if (beforeEventName === 'before-open') {
|
||||||
this.setInitialSize()
|
if (reset) {
|
||||||
this.shift.left = 0
|
this.setInitialSize()
|
||||||
this.shift.top = 0
|
this.shift.left = 0
|
||||||
|
this.shift.top = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
if (scrollable) {
|
||||||
|
document.body.classList.add('v--modal-block-scroll')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (beforeEventName === 'before-close') {
|
||||||
|
if (scrollable) {
|
||||||
|
document.body.classList.remove('v--modal-block-scroll')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let stopEventExecution = false
|
let stopEventExecution = false
|
||||||
@@ -489,6 +501,10 @@
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<style>
|
<style>
|
||||||
|
.v--modal-block-scroll {
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
.v--modal-overlay {
|
.v--modal-overlay {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
|
|||||||
Reference in New Issue
Block a user