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
dbb443d7
Commit
dbb443d7
authored
Nov 20, 2017
by
Nikolay Gromov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Разметка и JS для tooltips
parent
4b5967eb
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
106 additions
and
5 deletions
+106
-5
.stylelintrc
.stylelintrc
+0
-3
projectConfig.json
projectConfig.json
+2
-1
blocks-demo.html
src/blocks-demo.html
+24
-1
tooltip.html
src/blocks/tooltip/tooltip.html
+14
-0
tooltip.js
src/blocks/tooltip/tooltip.js
+33
-0
tooltip.scss
src/blocks/tooltip/tooltip.scss
+33
-0
No files found.
.stylelintrc
View file @
dbb443d7
...
@@ -82,9 +82,6 @@
...
@@ -82,9 +82,6 @@
"value-list-comma-space-before": ["never", {
"value-list-comma-space-before": ["never", {
"message": "В значениях перед запятой пробел запрещен"
"message": "В значениях перед запятой пробел запрещен"
}],
}],
"shorthand-property-no-redundant-values": [true, {
"message": "Для мнемоник значения повторять не следует"
}],
# "property-blacklist": [["text-rendering", "float"], {
# "property-blacklist": [["text-rendering", "float"], {
# "message": "Свойство из чёрного списка"
# "message": "Свойство из чёрного списка"
# }],
# }],
...
...
projectConfig.json
View file @
dbb443d7
...
@@ -57,7 +57,8 @@
...
@@ -57,7 +57,8 @@
"object-fit-polyfill"
:
[],
"object-fit-polyfill"
:
[],
"embed-responsive"
:
[],
"embed-responsive"
:
[],
"pie-chart"
:
[],
"pie-chart"
:
[],
"fields-group"
:
[]
"fields-group"
:
[],
"tooltip"
:
[]
},
},
"addCssBefore"
:
[
"addCssBefore"
:
[
"./src/scss/variables.scss"
,
"./src/scss/variables.scss"
,
...
...
src/blocks-demo.html
View file @
dbb443d7
...
@@ -1507,7 +1507,7 @@
...
@@ -1507,7 +1507,7 @@
</section>
</section>
<section
class=
"blocks-library__item
blocks-library__item--menusep
"
id=
"pie-chart"
data-name=
".pie-chart"
>
<section
class=
"blocks-library__item"
id=
"pie-chart"
data-name=
".pie-chart"
>
<h2
class=
"blocks-library__item-title"
>
Круговые диаграммы
</h2>
<h2
class=
"blocks-library__item-title"
>
Круговые диаграммы
</h2>
...
@@ -1532,6 +1532,29 @@
...
@@ -1532,6 +1532,29 @@
</section>
</section>
<section
class=
"blocks-library__item blocks-library__item--menusep"
id=
"tooltip"
data-name=
".tooltip"
>
<h2
class=
"blocks-library__item-title"
>
Подсказки
</h2>
<span
class=
"tooltip"
>
<button
class=
"tooltip__btn"
aria-label=
"more info"
data-tooltip-content=
"Текст подсказки может быть длинным. Хочется, чтобы <em>внутри</em> <small>можно было</small> <i>использовать</i> <b>разметку</b>."
>
Подсказка
</button>
</span>
<span
class=
"tooltip"
>
<button
class=
"tooltip__btn"
aria-label=
"more info"
data-tooltip-content=
"Текст."
>
Подсказка
</button>
</span>
<div
class=
"blocks-library__code-wrapper"
>
<span
class=
"blocks-library__code-show-trigger"
title=
"Показать код"
><i
class=
"blocks-library__code-icon"
></i></span>
<div
class=
"blocks-library__code"
>
<pre
class=
"code"
>
<code>
111
</code>
</pre>
</div>
</div>
</section>
...
...
src/blocks/tooltip/tooltip.html
0 → 100644
View file @
dbb443d7
<!--DEV
Для использования этого файла как шаблона:
@ @include('blocks/tooltip/tooltip.html')
(Нужно убрать пробел между символами @)
Подробнее: https://www.npmjs.com/package/gulp-file-include
<div class="tooltip">content</div>
-->
src/blocks/tooltip/tooltip.js
0 → 100644
View file @
dbb443d7
document
.
addEventListener
(
'DOMContentLoaded'
,
function
()
{
var
allTooltips
=
document
.
querySelectorAll
(
'.tooltip'
);
Array
.
prototype
.
forEach
.
call
(
allTooltips
,
function
(
tooltip
)
{
var
tooltipBtn
=
tooltip
.
querySelector
(
'.tooltip__btn'
);
var
messageWrap
=
document
.
createElement
(
'span'
);
var
message
=
tooltipBtn
.
getAttribute
(
'data-tooltip-content'
);
messageWrap
.
setAttribute
(
'role'
,
'status'
);
tooltip
.
appendChild
(
messageWrap
);
tooltipBtn
.
addEventListener
(
'click'
,
function
()
{
messageWrap
.
innerHTML
=
''
;
// window.setTimeout(function() {
messageWrap
.
innerHTML
=
'<span class="tooltip__bubble">'
+
message
+
'</span>'
;
// }, 100);
});
document
.
addEventListener
(
'click'
,
function
(
e
)
{
if
(
tooltipBtn
!=
e
.
target
)
{
messageWrap
.
innerHTML
=
''
;
}
});
tooltipBtn
.
addEventListener
(
'keydown'
,
function
(
e
)
{
if
((
e
.
keyCode
||
e
.
which
)
===
27
)
messageWrap
.
innerHTML
=
''
;
});
});
});
src/blocks/tooltip/tooltip.scss
0 → 100644
View file @
dbb443d7
// В этом файле должны быть стили для БЭМ-блока tooltip, его элементов,
// модификаторов, псевдоселекторов, псевдоэлементов, @media-условий...
// Очередность: http://nicothin.github.io/idiomatic-pre-CSS/#priority
.tooltip
{
$block-name
:
&
;
// #{$block-name}__element
position
:
relative
;
z-index
:
1
;
&
__bubble
{
position
:
absolute
;
top
:
calc
(
100%
+
15px
);
left
:
0
;
min-width
:
150px
;
max-width
:
250px
;
padding
:
10px
;
background-color
:
#007bff
;
&
:before
{
content
:
''
;
position
:
absolute
;
top
:
-5px
;
left
:
5px
;
width
:
0
;
height
:
0
;
border-style
:
solid
;
border-width
:
0
5px
5px
5px
;
border-color
:
transparent
transparent
#007bff
transparent
;
}
}
}
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