document.querySelector('.scroll-bl').addEventListener('click', function () {
document.querySelector('ul.level-scroll').scrollTop = 10;
})
<script src="http://cdnjs.cloudflare.com/ajax/libs/less.js/2.0.0/less.min.js"></script>
jQuery("nav > a").hSpy(
"section", {
classTargets : "active",
classTitles : "active",
spaces : false,
middleLine : 0,
bottomLine : 0,
axis : "y"
}
);
<div id="ya_share" class="ya-share2" data-services="vkontakte,twitter,facebook,gplus" data-counter></div>
Ya.share2('#ya_share', {
hooks: {
onready: function () {
alert('блок инициализирован');
},
onshare: function (name) {
alert('нажата кнопка' + name);
}
}
});
$(window).scroll(function () {
if ($(window).scrollTop() + $(window).height() > $('.footer').offset().top) {
yaCounterXXXXXX.reachGoal('TARGET_NAME');
}
});
<svg xmlns="http://www.w3.org/2000/svg"
width="920" height="160" viewBox="0 0 230 40">
<text text-anchor="middle" x="115" y="32" font-family="Times New Roman" font-size="35">
Hello, Toster
</text>
</svg>
получается такая картинка:$('.responsive').slick({
dots: false,
arrows: true,
nextArrow: '<i class="fa fa-angle-right" aria-hidden="true"></i>',
prevArrow: '<i class="fa fa-angle-left" aria-hidden="true"></i>',
infinite: false,
speed: 300,
slidesToShow: 3,
slidesToScroll: 3,
responsive: [
{
breakpoint: 1024,
settings: {
slidesToShow: 3,
slidesToScroll: 3,
infinite: false,
arrows: true,
dots: false
}
},
{
breakpoint: 700,
settings: {
slidesToShow: 2,
slidesToScroll: 2
}
},
{
breakpoint: 480,
settings: {
slidesToShow: 1,
slidesToScroll: 1
}
}
<div id="gallery">
<img src="1.jpg" alt>
<img src="2.jpg" alt>
<img src="3.jpg" alt>
…
</div>
div#gallery {
display: -ms-flexbox;
-ms-flex-direction: column;
-ms-flex-wrap: wrap;
display: flex;
flex-direction: column;
flex-wrap: wrap;
height: 100vw;
font-size: 0;
}
div#gallery img {
width: 33.3%;
transition: .8s opacity;
}
hp
), высоту окна (hw
)smax = hp - hw
и минимальный smin = 0
hmax
) и конечный (hmin
) размеры целевого элементаs
)ds = smax - smin = smax
dh = hmax - hmin
s / ds = h / dh , где h - приращение высоты целевого элемента
h = hmax - (dh * s) / ds
h = (dh * s) / ds + hmin
var element = document.getElementById('d');
var hp = document.body.scrollHeight,
hw = window.innerHeight,
smax = hp - hw,
smin = 0,
hmin = 100,
hmax = 300,
ds = smax - smin,
dh = hmax - hmin;
window.addEventListener('scroll', function () {
var s = window.pageYOffset; // current scrollTop
var h = hmax - (dh * s) / ds;
element.style.height = h + 'px';
});
var element = document.getElementById('d');
var hmin = 100,
hmax = 300;
window.addEventListener('scroll', function () {
var s = window.pageYOffset; // current scrollTop
var h = hmax - ((hmax - hmin) * s) / (document.body.scrollHeight - window.innerHeight);
element.style.height = h + 'px';
});