Commit 812bc81b authored by Nikolay Gromov's avatar Nikolay Gromov

Текстовые поля, Ресайзер блоков

parent 4a5a83dc
// Не работает в IE11 // Не работает в IE11
ready(function(){ ready(function(){
// Открытие/закрытие блока с кодом // Открытие/закрытие блока с кодом
var codeShowTriggers = document.querySelectorAll('.blocks-library__code-show-trigger'); var codeShowTriggers = document.querySelectorAll('.blocks-library__code-show-trigger');
for (var i = 0; i < codeShowTriggers.length; i++) { for (var i = 0; i < codeShowTriggers.length; i++) {
...@@ -7,4 +8,23 @@ ready(function(){ ...@@ -7,4 +8,23 @@ ready(function(){
this.closest('.blocks-library__code-wrapper').querySelector('.blocks-library__code').classList.toggle('blocks-library__code--shown'); this.closest('.blocks-library__code-wrapper').querySelector('.blocks-library__code').classList.toggle('blocks-library__code--shown');
}); });
} }
// Изменение размера шрифта на произвольном блоке
var parent, fontSizeEm;
$('.js-font-resizer')
.css('font-size', '1em')
.append('<div class="js-font-resizer__btns"><button class="btn btn--sm js-button-plus">+</button><button class="btn btn--sm js-button-null">0</button><button class="btn btn--sm js-button-minus">-</button></div>')
.on('click', 'button.js-button-plus', function(){
parent = $(this).closest('.js-font-resizer');
fontSizeEm = /(\d*\.?\d?)(em)/g.exec(parent.attr('style'));
parent.css('font-size', parent.css('font-size', parseFloat(fontSizeEm[0], 10) + 0.1 + 'em') );
}).on('click', 'button.js-button-minus', function(){
parent = $(this).closest('.js-font-resizer');
fontSizeEm = /(\d*\.?\d?)(em)/g.exec(parent.attr('style'));
parent.css('font-size', parent.css('font-size', parseFloat(fontSizeEm[0], 10) - 0.1 + 'em') );
}).on('click', 'button.js-button-null', function(){
parent = $(this).closest('.js-font-resizer');
parent.css('font-size', '1em' );
});
}); });
...@@ -109,5 +109,37 @@ ...@@ -109,5 +109,37 @@
max-height: 500px; max-height: 500px;
} }
} }
.js-font-resizer {
position: relative;
@media (min-width: @screen-md) {
&:hover {
.js-font-resizer__btns {
opacity: 1;
}
}
}
}
.js-font-resizer__btns {
margin-bottom: 1em;
font-size: 2rem;
transition: opacity .3s;
@media (min-width: @screen-md) {
opacity: 0.2;
position: absolute;
top: 0;
left: -4rem;
width: 4rem;
}
.btn {
width: 3rem;
text-align: center;
}
}
} }
This diff is collapsed.
...@@ -41,7 +41,7 @@ html input[disabled] { ...@@ -41,7 +41,7 @@ html input[disabled] {
} }
input[type='search'] { input[type='search'] {
-webkit-appearance: none; appearance: none;
} }
input[type='checkbox'], input[type='checkbox'],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment