All Projects → chenghaoc → Scrollbear

chenghaoc / Scrollbear

Licence: mit
A modern tool that maintains scroll position when images loaded

Programming Languages

javascript
184084 projects - #8 most used programming language

Labels

Projects that are alternatives of or similar to Scrollbear

Drab
Remote controlled frontend framework for Phoenix.
Stars: ✭ 833 (+59.27%)
Mutual labels:  view, dom
Facon
Tiny utility (272B) to create DOM elements with manner.
Stars: ✭ 212 (-59.46%)
Mutual labels:  view, dom
Crab
JavaScript library for building user interfaces with Custom Elements, Shadow DOM and React like API
Stars: ✭ 22 (-95.79%)
Mutual labels:  view, dom
crab
JavaScript library for building user interfaces with Custom Elements, Shadow DOM and React like API
Stars: ✭ 22 (-95.79%)
Mutual labels:  dom, view
Gomponents
Declarative view components in Go, that can render to HTML5.
Stars: ✭ 49 (-90.63%)
Mutual labels:  view, dom
prax
Experimental rendering library geared towards hybrid SSR+SPA apps. Focus on radical simplicity and performance. Tiny and dependency-free.
Stars: ✭ 18 (-96.56%)
Mutual labels:  dom, view
Materialtimelineview
With MaterialTimelineView you can easily create a material looking timeline.
Stars: ✭ 443 (-15.3%)
Mutual labels:  view
Bunny
BunnyJS - Lightweight native (vanilla) JavaScript (JS) and ECMAScript 6 (ES6) browser library, package of small stand-alone components without dependencies: FormData, upload, image preview, HTML5 validation, Autocomplete, Dropdown, Calendar, Datepicker, Ajax, Datatable, Pagination, URL, Template engine, Element positioning, smooth scrolling, routing, inversion of control and more. Simple syntax and architecture. Next generation jQuery and front-end framework. Documentation and examples available.
Stars: ✭ 473 (-9.56%)
Mutual labels:  dom
Lucia
🙋‍♀️ 3kb library for tiny web apps
Stars: ✭ 439 (-16.06%)
Mutual labels:  dom
Weatherview
WeatherView is an Android Library let you make cool weather animations for your app
Stars: ✭ 426 (-18.55%)
Mutual labels:  view
Motus
Animation library that mimics CSS keyframes when scrolling.
Stars: ✭ 502 (-4.02%)
Mutual labels:  dom
Popview Android
Pop animation with circular dust effect for any view updation
Stars: ✭ 487 (-6.88%)
Mutual labels:  view
Waitview
显示等待加载状态的View
Stars: ✭ 465 (-11.09%)
Mutual labels:  view
Hyperawesome
A curated list of awesome projects built with Hyperapp & more.
Stars: ✭ 446 (-14.72%)
Mutual labels:  dom
Csshake
CSS classes to move your DOM!
Stars: ✭ 4,531 (+766.35%)
Mutual labels:  dom
Imba
🐤 The friendly full-stack language
Stars: ✭ 5,434 (+939.01%)
Mutual labels:  dom
Happybubble
💭BubbleLayout随意变化的气泡布局、消息对话框,可定制颜色,背景、弧度、尖角弧度、边框等等。BubbleDialog气泡弹窗根据点击View的位置定位它的弹窗位置,BubbleDialog可定制方向等!(BubbleLayout changes freely,BubbleDialog click on the location of View positioning its location,BubbleDialog can be customized directions.)
Stars: ✭ 487 (-6.88%)
Mutual labels:  view
Jsdom Global
Enable DOM in Node.js
Stars: ✭ 431 (-17.59%)
Mutual labels:  dom
Freepager
ViewPagers library for Android
Stars: ✭ 461 (-11.85%)
Mutual labels:  view
Laravel Blade Javascript
A Blade directive to export variables to JavaScript
Stars: ✭ 485 (-7.27%)
Mutual labels:  view

Scrollbear

Scrollbear is a tool that maintains the container scroll position when images loaded. Scrollbear is suitable in blog platforms where exist many photos and images. When images loaded, the scroll position will jump and cause a unfriendly experience. Scrollbear will trace the container height and maintain the scroll position when the images loaded and container height change.

** Since Google Chrome launch scolling anchor feature, there's no difference with or without Scrollbear in Chrome browser.

Demo

Installation

npm install scrollbear

Usage

<div id='scroll' style='overflow: scroll;'>
    <div id='container'>
        <p>long content</p>
        <p>long content</p>
    </div>
</div>
<script src='scrollbear.js'></script>
Scrollbear.start(document.getElementById('scroll'))

API

Scrollbear.start(target, [changedItems])

target is the DOM where scroll bar exists (Normally is the container of contents), normally the direct child node of this target will be a DOM with really long content (such as the content of blog articles).

changeItems is optional. It is useful when images is lazy loading into your page. In such case, you can specify the placeholder of images. When images is lazy-loaded, the height of placeholder will change, and trigger the Scrollbear to justify the scroll position.

Scrollbear.stop()

Scrollbear.onChange(callback)

callback function will be called when Scrollbear detects container height changes and adjust the scroll position. The first param of callback will be the target which height changed.

Development

Install development dependency

npm install

Build

gulp

Test

npm test

Contribute

Issues or PR are all Welcome!

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].