var owl = $('.owl-carousel');
owl.owlCarousel();
// Go to the next item
$('.customNextBtn').click(function() {
owl.trigger('next.owl.carousel');
})
.main-nav:hover .sub-menu {
visibility: visible;
opacity: 1;
}
.menu-item:hover .sub-menu {
visibility: visible;
opacity: 1;
}
$(".each-avatar .avatar").click(function(){
$(this).next().animate({height: 'show'}, 500);
});
$(".each-avatar .info-block").click(function(){
$(this).animate({height: 'hide'}, 500);
});
});
<div class="item">
<img src="http://lorempixel.com/400/300/" alt="">
<div class="wrap-text">
<div>
<h2>Заголовок второго уровня</h2>
<p>Lorem ipsum dolor sit amet, consectetur<br> adipisicing elit. Ipsam, deleniti.</p></div>
</div>
</div>
.wrap-text {
position: absolute;
width: 100%;
top: 13px;
padding: 0 10px;
}
.wrap-text > div {
padding: 10px;
background: red;
}
.item {
position: relative;
float: left;
width: calc(33.33333% - 20px);
margin-right: 20px;
}
.video_block iframe {
position: relative;
z-index: -1;
}
<div class="class">
<p></p>
<p></p>
<img src="image.jpg" />
</div>
.class p:nth-child(2){
font-weight: bold;
}
(function(w, d){
var childOf = function (child, parent) {
while((child=child.parentNode) && child!==parent);
return !!child;
};
var initApp = function() {
var activeTab,
menu = d.querySelector('#menu'),
firstLevel = menu.children || [],
ln = firstLevel.length;
var tabClickHandler = function (e) {
e.preventDefault();
if (!activeTab) {
activeTab = this;
} else {
activeTab.classList.remove('active');
activeTab = this;
}
this.classList.add('active');
};
var innerTabClickHandler = function (e) {
e.preventDefault();
e.stopPropagation();
if (activeTab) {
activeTab.classList.remove('active');
}
};
var closeMenuHandler = function (e) {
var target = e.target || e.srcElement;
if(!childOf(target, menu)) {
if (activeTab) {
activeTab.classList.remove('active');
}
}
};
if (!ln) return;
while(ln--) {
var tab = firstLevel[ln],
secondLevel = tab.querySelectorAll('ul > li') || [],
lnS = secondLevel.length;
tab.addEventListener('click', tabClickHandler, false);
while(lnS--) {
var innerTab = secondLevel[lnS];
innerTab.addEventListener('click', innerTabClickHandler, false);
}
}
d.addEventListener('click', closeMenuHandler, false);
};
w.addEventListener('DOMContentLoaded', initApp);
}(window, document));
$("input[type=text]").each(function() {
var input = $(this), id = this.id;
input.attr('name', id);
});
<meta name="viewport" content="width=device-width,initial-scale=1" id="viewport" />
(function (w, d) {
var viewport = d.querySelector('#viewport'),
viewports = {
default: viewport.getAttribute('content'),
small: 'width=320'
};
var viewport_set = function() {
screen.width <= 320 ? viewport.setAttribute( 'content', viewports.small) : viewport.setAttribute( 'content', viewports.default );
}
//При загрузке
viewport_set();
// При изменении
w.onresize = function() {
viewport_set();
}
}(window, document));
<link rel="stylesheet" type="text/css" media="only screen and (max-device-width: 480px)" href="mobile-device.css" />
<ul>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
ul {
width: 70%;
font-size: 0;
list-style: none;
}
ul li {
display: inline-block;
width: 50%;
padding: 10% 0;
overflow: hidden;
background-size: cover;
background-position: 50% 50%;
}
ul li:nth-child(1) {
background-image: url(http://untifler.narod.ru/photos/gaf8-1s.jpg);
}
ul li:nth-child(2) {
background-image: url(http://www.gjkt.cz/files/images/budova.jpg);
}
ul li:nth-child(3) {
background-image: url(http://imageproxy.jxs.cz/~nd04/jxs/cz~/856/512/fbafffc141_70326674_o2.jpg);
}
ul li:nth-child(4) {
background-image: url(http://untifler.narod.ru/photos/gaf8-1s.jpg);
}
img {
width: 100%;
}