-
var obj = [
{title: 'first title', text: 'first text'},
{title: 'second <span class="accent">title</span> ', text: 'second text'},
{title: 'third title', text: 'third text'}
]
mixin features(title, text)
.block
.block__item
img.block__img(src="/img/block/1.jpg")
.block__title!= title
p.block__capture= text
each val, index in obj
+features(val.title, val.text)
$('.rows.left .row').each(function(ind, el) {
var $left = $(el);
var $right = $('.rows.right .row').eq(ind);
if ($left.height() < $right.height()) {
$left.css('height', $right.height() + 'px')
} else {
$right.css('height', $left.height() + 'px')
}
});
$.ajax({
type: 'POST',
url: $form.attr('action'),
data: $form.serialize(),
success: function (response) {
response = JSON.parse(response);
if (response.type && response.type === 'success') {
$.magnificPopup.open({
items: {
src: '#popup-sank',
type: 'inline'
},
removalDelay: 500, //delay removal by X to allow out-animation
mainClass: 'my-mfp-zoom-in',
closeBtnInside: false
});
$form[0].reset();
} else {
}
},
error: function (response) {
}
});
// Создаем новый <span>
var sp1 = document.createElement("span");
// Получаем ссылку на элемент, перед которым мы хотим вставить sp1
var sp2 = document.getElementById("childElement");
//Получаем ссылку на родителя sp2
var parentDiv = sp2.parentNode;
// Вставляем sp1 перед sp2
parentDiv.insertBefore(sp1, sp2);