javascript Vanialla Sticky
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了javascript Vanialla Sticky相关的知识,希望对你有一定的参考价值。
var $ao_body = $('body'),
$languages_height = $(el).height(),
scroll_start = 1300;
function addStickyClasses() {
$(el).addClass('is-scrolled');
}
function removeStickyClasses() {
$(el).removeClass('is-scrolled');
}
function stickyResize() {
if($(window).width() < scroll_start) {
removeStickyClasses();
}
}
function stickyHeader() {
var wst = $(window).scrollTop();
if( $(window).width() >= scroll_start ) {
var offset_item = $(el).offset().top - wst,
content_offset = $(el).offset().top - wst;
if(wst >= $languages_height) {
$(thing).addClass('is-pinned');
} else {
$(thing).removeClass('is-pinned');
}
if ( content_offset <= other_offset ) {
addStickyClasses();
} else {
removeStickyClasses();
}
}
}
if (window.matchMedia("(min-width: 1080px)").matches) {
stickyHeader();
$(window).on('scroll', stickyHeader);
}
$(window).resize(stickyResize);
以上是关于javascript Vanialla Sticky的主要内容,如果未能解决你的问题,请参考以下文章
Sicily-Stick
D. Cut and Stick
如何在 C# 中获取 USB-Stick 的序列号
centos 特殊权限stick用法
hdu 5655 CA Loves Stick
stick footers布局