<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" />
if (obj.nextSibling){
console.log(obj.nextSibling);
document.getElementById('inputi').insertBefore(new_input,obj.nextSibling)
}else{ document.getElementById('inputi').appendChild(new_input);}
document.getElementById('inputi').appendChild(new_input);
<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%;
}
<div id="mono">
<input type="checkbox" name="image" id="tonggle" />
<label for="tonggle">
<img src="http://wikipics.net/photos/20150206142322639625248.jpg" >
</label>
<div id="tex">Praesent sodales suscipit eros ut tempor. Curabitur pulvinar lectus ut enim gravida dictum. Vivamus eget nunc diam. Donec nec risus dictum, ullamcorper erat non, rutrum purus. Mauris lacus nibh, ornare sit amet ipsum et, rutrum sagittis tellus. Cras tincidunt facilisis facilisis. Cras lectus elit, efficitur at est nec, dictum gravida diam. Praesent eget ex porttitor nisi egestas commodo placerat vel eros. Nam sed justo congue, lobortis felis quis, fermentum massa. Donec egestas faucibus magna vitae maximus. Integer non facilisis dolor. Maecenas posuere elit ut magna bibendum, sit amet iaculis justo tempus. Vivamus vulputate eu neque quis hendre</div>
</div>
#mono {
width: 500px;
margin: 0 auto;
overflow: hidden;
position: relative;
}
#mono label {
width: 100%;
height: 100%;
display: block;
cursor: pointer;
z-index: 2;
position: relative;
}
#mono input {
position: absolute;
left: -9999px;
}
#mono input:checked + label img {
-webkit-transform: translate(0, -350px);
-ms-transform: translate(0, -350px);
transform: translate(0, -350px);
}
#mono #tex {
position: absolute;
padding: 20px;
z-index: 1;
top: 0;
left: 0;
}
#mono img {
width: 500px;
position: relative;
-webkit-transition: -webkit-transform 1s;
transition: transform 1s;
}
.cont-title {
background-color: green;
}
.cont-title a {
background-color: white;
display: inline-block;
}
.cart {
background-color: white;
}
<div class="cont-title">
<a href="#" class="cell">
<h1>Заголовок</h1>
</a>
<div class="cell cell--mid"></div>
<div class="cart cell">Дата</div>
</div>
.cont-title {
display: table;
}
.cell {
display: table-cell;
}
.mid {
width: 100%;
background-color: green;
}
(function() {
var lastTime = 0;
var vendors = ['ms', 'moz', 'webkit', 'o'];
for(var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) {
window.requestAnimationFrame = window[vendors[x]+'RequestAnimationFrame'];
window.cancelAnimationFrame = window[vendors[x]+'CancelAnimationFrame']
|| window[vendors[x]+'CancelRequestAnimationFrame'];
}
if (!window.requestAnimationFrame)
window.requestAnimationFrame = function(callback, element) {
var currTime = new Date().getTime();
var timeToCall = Math.max(0, 16 - (currTime - lastTime));
var id = window.setTimeout(function() { callback(currTime + timeToCall); },
timeToCall);
lastTime = currTime + timeToCall;
return id;
};
if (!window.cancelAnimationFrame)
window.cancelAnimationFrame = function(id) {
clearTimeout(id);
};
}());
#bg {
background: rgba(0,0,0,.6);
position: fixed;
left: 0;
top: 0;
width: 320px;
height: 100%;
z-index: 100;
overflow: auto;
}
#form {
width: 150px;
min-height: 520px;
padding: .3em 1em;
background: #fff;
border-radius: 12px;
z-index: 200;
top: 20px;
margin: 1em auto;
}
$flexslider.hide();
$flexslider.css({'visibility': 'hidden'});
//и
$flexslider.css({'visibility': 'visibility'});
flexsliderInit: function () {
$('.slider').flexslider({
controlsContainer: ".flex-control-thumbs",
animation: 'slide',
direction: "horizontal",
animationLoop: false,
slideshow: false,
controlNav: true,
directionNav:true,
manualControls: ".flex-control-thumbs .list-cell",
start: function(slider){
var $flexslider = $('.flexslider');
$flexslider.css({'visibility': 'hidden'});
var $thumbs = $('.list-cell'), timer;
$('.list-cell').each(function(){
$(this).on('click', function(e){
clearTimeout(timer);
timer = setTimeout(function () {
$flexslider.css({'visibility': 'visible'});
}, 500);
e.preventDefault();
$(window).trigger('resize');
$slideItems = $('.list-cell--overlay');
$slideItems.each(function () {
var $item = $(this), $close = $item.find('.close');
$close.on('click', function () {
$flexslider.hide();
});
});
});
});
}
});
}
(function() {
var app = angular.module('testApp', [
'ngRoute'
]);
app.config(function($routeProvider) {
$routeProvider.when('/page', {
templateUrl: 'test.tpl.html',
controller: 'TestCtrl'
});
});
app.controller('TestCtrl', function($scope) {
console.log('тут уже можно пользоваться теми скриптами, которые подгрузили во вьюхе');
});
})();
<div class="testView">
<script src="testFunction.js"></script>
</div>
document.addEventListener( "DOMContentLoaded", function () {
alert('Меня подгрузили!!!');
}, false );
});
$pattern = '<a href=\"([^\"(?!mailto|tel|#)].*)\">(.*)<\/a>';