<button id="button3" class="js-card-fade" data-card-id="3"></button>
<div class="js-card" data-id="3"></div>
$('.js-card-fade').hover(function () {
$('.js-card[data-id=' + $(this).data('card-id')).fadeIn();
}, function () {
$('.js-card[data-id=' + $(this).data('card-id')).fadeOut();
});
$('.my_some_btn').on('click',function(){
$('.my_some_block').toggleClass('animate');
});
var text = "SELECT * FROM [driving license] WHERE name_driver={{user.name}}";
templater(text, {
user: {
name: 'Олег'
}
});
//> "SELECT * FROM [driving license] WHERE name_driver=Олег"
var text = "SELECT * FROM [driving license] WHERE name_driver={{name}}";
templater(text, {
name: 'Олег'
});
//> "SELECT * FROM [driving license] WHERE name_driver=Олег"
/**
* Обработка тегов, шаблонизатор
* @param {String} Входные данные
* @param {Object} Объект {тег - значение}
* @returns {String} Выходные, обработаные данные
**/
function templater(input, data) {
if (!['string', 'object'].includes(typeof input)) {
return input;
}
for (var key in data) {
if (Object.prototype.hasOwnProperty.call(data, key)) {
if (typeof data[key] === 'object' && data[key] !== null && !Array.isArray(data[key])) {
var nested = {};
for (var name in data[key]) {
nested[key + '.' + name] = data[key][name];
}
input = templater(input, nested);
} else {
input = input.replace(new RegExp('\{\{' + key + '\}\}', 'g'), data[key]);
}
}
}
return input;
}
scrollTop:$('#' + $(this).data('value')).offset().top
scrollTop:$('#' + $(this).find('a').data('value')).offset().top
@media (max-width: 768px) and (min-width: 320px) {
.main .nav-block .navbar {
display: inline-block;
/* position: absolute; */
/* right: 0; */
float: right; }
.navbar-collapse {
position: absolute;
width: 100%;
left: 0px;
z-index: 10; }
.main .nav-block .navbar .navbar-collapse .navbar-nav,
.navbar {
position: static; }
}