• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

davist11/jQuery-Stickem: Make items sticky as you scroll, to a point.

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称:

davist11/jQuery-Stickem

开源软件地址:

https://github.com/davist11/jQuery-Stickem

开源编程语言:

JavaScript 87.2%

开源软件介绍:

Make items sticky as you scroll, to a point. (See Demo)

Usage

<div class="container">
	<div class="row stickem-container">
		<div class="content">
			Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
		</div>
		
		<div class="aside stickem">
		  I'm gonna be sticky!
		</div>
	</div>
</div>
.stickem-container {
  position: relative;
}

.stickit {
	margin-left: 660px;
	position: fixed;
	top: 0;
}

.stickit-end {
	bottom: 40px;
	position: absolute;
	right: 0;
}
$('.container').stickem();

Defaults

item: '.stickem'
Items that you want to stick on scroll.

container: '.stickem-container'
Container that you want the sticky item to be contained in.

stickClass: 'stickit'
Class added to the sticky item once it should start being sticky.

endStickClass: 'stickit-end'
Class added to the sticky item once it has reached the end of the container

offset: 0
Do you already have a fixed horizontal header on the page? Offset stick 'em by that many pixels.

start: 0
If your sticky item isn't at the top of the container, tell it where it should start being sticky.

onStick: null
You can create a callback function that fires when an item gets "stuck". The item gets passed back.

onUnstick: null
You can create a callback function that fires when an item gets "un-stuck". The item gets passed back.

Destroying

If you have a bunch of stuff that happens after your page has loaded (e.g. AJAX requests) that changes the height of your containers and page, and you need to "destroy" stick 'em, do it like this:

var sticky = $('.container').stickem();
sticky.destroy();

Then you can re-instantiate again if you need to.




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap