插件 jQuery.Scroll up bar 中文API文档

🌙
手机阅读
本文目录结构

插件 jQuery.Scroll up bar 中文API文档 https://github.com/eduardomb/scroll-up-bar

ScrollUpBar Plugin

The scroll up bar plugin (jQuery) hides the top bar when scrolling down, and show it when scrolling up. It’s specially useful on mobile interfaces to save some precious space.

Demos

Installation

Include jQuery and scroll-up-bar.min.js scripts:

<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="scroll-up-bar.min.js"></script>

Bower users can get the source with:

bower install scroll-up-bar

Basic Usage

Create a top bar using position absolute.

<div id="topbar" style="position: absolute; top: 0; left: 0; width: 100%; background: #ccc;">
  Top bar
</div>

Tip: you can also add top different than zero

And then invoke scrollupbar() on the element.

$('#topbar').scrollupbar();

Alternatively you can invoke with $.scrollupbar($('#topbar'))

Options

You can pass callback functions in initialization to handle bar visibility events.

  • enterViewport - when the bar enters the viewport
  • fullyEnterViewport - when the bar is completely in the viewport
  • exitViewport - when the bar completely leaves the viewport
  • partiallyExitViewport - when the bar goes from being fully in the viewport to only partially

Checkout the callback example.

Properties

There are two global boolean properties that are updated according to bar visibility.

  • $.scrollupbar.isInViewport - true if any part of the bar is visible, false if not
  • $.scrollupbar.isFullyInViewport - true if the entire bar is visible

Methods

  • $.scrollupbar.destroy - restores bar to original position and disables plugin

Browser support

The plugin was tested on:

  • Chrome
  • Firefox
  • Safari
  • Opera
  • IE

Contributing

Read the Contributing document for instructions on how to set up your development environment to build and test scroll-up-bar.


AXIHE / 精选资源

浏览全部教程

面试题

学习网站

前端培训
自己甄别

前端书籍

关于朱安邦

我叫 朱安邦,阿西河的站长,在杭州。

以前是一名平面设计师,后来开始接接触前端开发,主要研究前端技术中的JS方向。

业余时间我喜欢分享和交流自己的技术,欢迎大家关注我的 Bilibili

关注我: Github / 知乎

目前重心已经放在研究区块链上面了

我叫朱安邦,阿西河的站长

目前在杭州从事区块链周边的开发工作,机械专业,以前从事平面设计工作。

2014年底脱产在老家自学6个月的前端技术,自学期间几乎从未出过家门,最终找到了满意的前端工作。更多>