Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
K
kpp
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alexandr Veselov
kpp
Commits
54e4917a
Commit
54e4917a
authored
Mar 29, 2017
by
Nikolay Gromov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Добавил модальные окна
parent
8e86fca4
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
110 additions
and
16 deletions
+110
-16
blocks-demo.html
src/blocks-demo.html
+64
-2
modal.js
src/blocks/modal/modal.js
+13
-12
modal.scss
src/blocks/modal/modal.scss
+33
-2
No files found.
src/blocks-demo.html
View file @
54e4917a
...
@@ -1795,7 +1795,7 @@
...
@@ -1795,7 +1795,7 @@
<h2
class=
"blocks-library__item-title"
>
Модальные окна
</h2>
<h2
class=
"blocks-library__item-title"
>
Модальные окна
</h2>
<p>
Основан на modal.js из Bootstrap. Изменения минимальны (имена классов, пространство имен событий).
</p>
<p>
Основан на modal.js из Bootstrap. Изменения минимальны (имена классов, пространство имен событий
, некоторые упрощения
).
</p>
<p
class=
"alert alert--warning"
>
Зависит от
<a
href=
"https://jquery.com/"
>
jQuery
</a>
(включен в сборку по умолчанию).
</p>
<p
class=
"alert alert--warning"
>
Зависит от
<a
href=
"https://jquery.com/"
>
jQuery
</a>
(включен в сборку по умолчанию).
</p>
...
@@ -1803,10 +1803,59 @@
...
@@ -1803,10 +1803,59 @@
<a
href=
"#modal-demo-02"
data-toggle=
"modal"
>
Показать модальное окно 2
</a>
<a
href=
"#modal-demo-02"
data-toggle=
"modal"
>
Показать модальное окно 2
</a>
<span
data-toggle=
"modal"
data-target=
"#modal-demo-03"
>
Показать модальное окно 3
</span>
<span
data-toggle=
"modal"
data-target=
"#modal-demo-03"
>
Показать модальное окно 3
</span>
<p>
Методы:
</p>
<pre
class=
"code"
>
<code>
$('#modal-demo-01').modal(options)
</code>
<code
onclick=
"$('#modal-demo-01').modal('show');"
>
$('#modal-demo-01').modal('show')
</code>
<code
onclick=
"$('#modal-demo-01').modal('hide');"
>
$('#modal-demo-01').modal('hide')
</code>
<code
onclick=
"$('#modal-demo-01').modal('toggle');"
>
$('#modal-demo-01').modal('toggle')
</code>
</pre>
<p>
События:
</p>
<pre
class=
"code"
>
<code>
$('#modal-demo-01').on('show.nth.modal', function(){
</code>
<code>
console.log('show.nth.modal');
</code>
<code>
});
</code>
<code>
$('#modal-demo-01').on('shown.nth.modal', function(){
</code>
<code>
console.log('shown.nth.modal');
</code>
<code>
});
</code>
<code>
$('#modal-demo-01').on('hide.nth.modal', function(){
</code>
<code>
console.log('hide.nth.modal');
</code>
<code>
});
</code>
<code>
$('#modal-demo-01').on('hidden.nth.modal', function(){
</code>
<code>
console.log('hidden.nth.modal');
</code>
<code>
});
</code>
</pre>
<div
class=
"blocks-library__code-wrapper"
>
<div
class=
"blocks-library__code-wrapper"
>
<span
class=
"blocks-library__code-show-trigger"
title=
"Показать код"
><i
class=
"blocks-library__code-icon"
></i></span>
<span
class=
"blocks-library__code-show-trigger"
title=
"Показать код"
><i
class=
"blocks-library__code-icon"
></i></span>
<div
class=
"blocks-library__code"
>
<div
class=
"blocks-library__code"
>
<pre
class=
"code"
>
111
</pre>
<pre
class=
"code"
>
<code>
<
button class="btn" type="button" data-toggle="modal" data-target="#modal-demo-01">Показать модальное окно 1
<
/button>
</code>
<code>
<
a href="#modal-demo-01" data-toggle="modal">Показать модальное окно 2
<
/a>
</code>
<code>
<
span data-toggle="modal" data-target="#modal-demo-01">Показать модальное окно 3
<
/span>
</code>
<code>
</code>
<code>
<
div id="modal-demo-01" class="modal" tabindex="-1" role="dialog">
</code>
<code>
<
div class="modal__dialog" role="document">
</code>
<code>
<
div class="modal__content">
</code>
<code>
<
div class="modal__header">
</code>
<code>
<
span class="close modal__close" data-dismiss="modal" aria-label="Закрыть">
<
span>
<
/span>
<
/span>
</code>
<code>
<
h4 class="modal__title">Modal 01 title
<
/h4>
</code>
<code>
<
/div>
</code>
<code>
<
div class="modal__body">...
<
/div>
</code>
<code>
<
div class="modal__footer">
</code>
<code>
<
button type="button" class="btn" data-dismiss="modal">Закрыть
<
/button>
</code>
<code>
<
/div>
</code>
<code>
<
/div>
</code>
<code>
<
/div>
</code>
<code>
<
/div>
</code>
</pre>
</div>
</div>
</div>
</div>
...
@@ -1882,6 +1931,19 @@
...
@@ -1882,6 +1931,19 @@
var
offCanvasMenuContent
=
document
.
getElementById
(
'off-canvas-menu'
);
var
offCanvasMenuContent
=
document
.
getElementById
(
'off-canvas-menu'
);
offCanvasMenuContent
.
innerHTML
=
offCanvasMenu
;
offCanvasMenuContent
.
innerHTML
=
offCanvasMenu
;
$
(
'#modal-demo-01'
).
on
(
'show.nth.modal'
,
function
(){
console
.
log
(
'show.nth.modal'
);
});
$
(
'#modal-demo-01'
).
on
(
'shown.nth.modal'
,
function
(){
console
.
log
(
'shown.nth.modal'
);
});
$
(
'#modal-demo-01'
).
on
(
'hide.nth.modal'
,
function
(){
console
.
log
(
'hide.nth.modal'
);
});
$
(
'#modal-demo-01'
).
on
(
'hidden.nth.modal'
,
function
(){
console
.
log
(
'hidden.nth.modal'
);
});
});
});
</script>
</script>
...
...
src/blocks/modal/modal.js
View file @
54e4917a
...
@@ -25,21 +25,21 @@
...
@@ -25,21 +25,21 @@
this
.
scrollbarWidth
=
0
this
.
scrollbarWidth
=
0
this
.
ignoreBackdropClick
=
false
this
.
ignoreBackdropClick
=
false
if
(
this
.
options
.
remote
)
{
//
if (this.options.remote) {
this
.
$element
//
this.$element
// .find('.modal-content')
//
// .find('.modal-content')
.
find
(
'.modal__content'
)
//
.find('.modal__content')
.
load
(
this
.
options
.
remote
,
$
.
proxy
(
function
()
{
//
.load(this.options.remote, $.proxy(function () {
// this.$element.trigger('loaded.bs.modal')
//
// this.$element.trigger('loaded.bs.modal')
this
.
$element
.
trigger
(
'loaded.nth.modal'
)
//
this.$element.trigger('loaded.nth.modal')
},
this
))
//
}, this))
}
//
}
}
}
Modal
.
VERSION
=
'3.3.7'
Modal
.
VERSION
=
'3.3.7'
Modal
.
TRANSITION_DURATION
=
300
//
Modal.TRANSITION_DURATION = 300
Modal
.
BACKDROP_TRANSITION_DURATION
=
150
//
Modal.BACKDROP_TRANSITION_DURATION = 150
Modal
.
DEFAULTS
=
{
Modal
.
DEFAULTS
=
{
backdrop
:
true
,
backdrop
:
true
,
...
@@ -89,7 +89,8 @@
...
@@ -89,7 +89,8 @@
}
}
that
.
$element
that
.
$element
.
show
()
// .show()
.
css
(
'display'
,
'flex'
)
.
scrollTop
(
0
)
.
scrollTop
(
0
)
that
.
adjustDialog
()
that
.
adjustDialog
()
...
...
src/blocks/modal/modal.scss
View file @
54e4917a
...
@@ -9,6 +9,8 @@ $font-size--h4: 1.25em !default;
...
@@ -9,6 +9,8 @@ $font-size--h4: 1.25em !default;
$line-height
:
1
.375em
!
default
;
$line-height
:
1
.375em
!
default
;
$screen-lg
:
992px
!
default
;
$opacity
:
0
.7
!
default
;
$opacity
:
0
.7
!
default
;
$transition-time
:
0
.3s
!
default
;
$transition-time
:
0
.3s
!
default
;
...
@@ -42,6 +44,15 @@ $z-index-modal: 100 !default;
...
@@ -42,6 +44,15 @@ $z-index-modal: 100 !default;
margin
:
0
;
margin
:
0
;
width
:
100%
;
width
:
100%
;
height
:
100%
;
height
:
100%
;
@media
(
min-width
:
$screen-lg
)
{
width
:
600px
;
height
:
auto
;
#{
$block-name
}
--open
&
{
animation
:
modal-content-show
$transition-time
1
both
;
}
}
}
}
&
__content
{
&
__content
{
...
@@ -92,12 +103,19 @@ $z-index-modal: 100 !default;
...
@@ -92,12 +103,19 @@ $z-index-modal: 100 !default;
left
:
0
;
left
:
0
;
z-index
:
(
$z-index-modal
-
1
);
z-index
:
(
$z-index-modal
-
1
);
background-color
:
rgba
(
0
,
0
,
0
,
$opacity
);
background-color
:
rgba
(
0
,
0
,
0
,
$opacity
);
@media
(
min-width
:
$screen-lg
)
{
animation
:
modal-backdrop-show
$transition-time
1
;
animation
:
modal-backdrop-show
$transition-time
1
;
}
}
}
&
--open
{
&
--open
{
#{
$block-name
}
__dialog
{}
@media
(
min-width
:
$screen-lg
)
{
display
:
flex
;
justify-content
:
center
;
align-items
:
center
;
}
}
}
}
}
...
@@ -113,3 +131,16 @@ $z-index-modal: 100 !default;
...
@@ -113,3 +131,16 @@ $z-index-modal: 100 !default;
opacity
:
1
;
opacity
:
1
;
}
}
}
}
@keyframes
modal-content-show
{
0
%
{
opacity
:
0
;
transform
:
translateY
(
-2em
);
}
100
%
{
opacity
:
1
;
transform
:
translateY
(
0
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment