Giter VIP home page Giter VIP logo

naver / egjs-flicking Goto Github PK

View Code? Open in Web Editor NEW
2.7K 29.0 127.0 162.79 MB

๐ŸŽ  โ™ป๏ธ Everyday 30 million people experience. It's reliable, flexible and extendable carousel.

Home Page: https://naver.github.io/egjs-flicking/

License: MIT License

JavaScript 5.35% HTML 3.39% CSS 3.13% TypeScript 78.32% Vue 8.55% Svelte 1.16% Sass 0.10%
egjs javascript carousel iscroll react slider typescript angular reactjs vue

egjs-flicking's Introduction

version npm bundle size (scoped) Coveralls github DeepScan grade

GitHub commit activity npm downloads per month GitHub contributors GitHub

Angular React Vue Preact Svelte

Everyday 30 million people experience. It's reliable, flexible and extendable carousel.
๐Ÿ“ฑ๐Ÿ’ป๐Ÿ–ฅ

Supported Frameworks
AngularJSย ย  Reactย ย  Vue.jsย ย  Preactย ย  Svelte


iPhone demo Music app demo Full page demo
Parallax demo
๐Ÿ–ฑ๏ธClick each images to see its source or check our full demos.

โœจ Features

  • Use it in a framework you like.
    • We supports all major JS frameworks like React, Vue, Angular
  • SSR(Server Side Rendering) ready
    • You can use Flicking at your favorite SSR frameworks like Next.js or Nuxt.js.
  • Circular(Loop) Mode
  • Ready-to-use plugins you can grab right away.
    • Autoplay, Fade effect, Parallax effect, ...
  • Restore state like position and active slide with persist
  • You can make native-scroll like UI with bound and moveType: freeScroll
  • Supports both Desktop & Mobile
  • Rich API
  • Supports IE9+ with the polyfill

โš™๏ธ Installation

npm

$ npm install --save @egjs/flicking

CDN

๐Ÿƒ Quick Start

HTML

Flicking requires minimal structure to initialize properly.

You don't need to consider this when using Flicking with the frameworks.

<div id="my-flicking" class="flicking-viewport">
  <div class="flicking-camera">
    <div class="panel"></div>
    <div class="panel"></div>
    <div class="panel"></div>
  </div>
</div>

ES Modules

import Flicking from "@egjs/flicking";
// import styles
import "@egjs/flicking/dist/flicking.css"; // Supports IE10+, using CSS flex
// Or...
import "@egjs/flicking/dist/flicking.inline.css"; //Supports IE9+, using CSS inline-box

const flicking = new Flicking("#my-flicking", { circular: true });

With CDN

<!-- Packaged with all dependencies -->
<script src="https://unpkg.com/@egjs/[email protected]/dist/flicking.pkgd.min.js"></script>
<link rel="stylesheet" href="https://unpkg.com/@egjs/[email protected]/dist/flicking.css">
var flicking = new Flicking("#my-flicking", { circular: true });

๐Ÿ“ฆ Packages

Package Version Description
@egjs/flicking-plugins version Readymade effects for your carousel
@egjs/ngx-flicking version Angular Angular port of @egjs/flicking
@egjs/react-flicking version React React port of @egjs/flicking
@egjs/vue-flicking version Vue.js Vue.js@2 port of @egjs/flicking
@egjs/vue3-flicking version Vue.js Vue.js@3 port of @egjs/flicking
@egjs/preact-flicking version Preact Preact port of @egjs/flicking
@egjs/svelte-flicking version Svelte Svelte port of @egjs/flicking

๐ŸŒ Supported Browsers

IE Chrome Firefox Safari iOS Android
9+(With polyfill), 11+ for Angular & Svelte Latest Latest Latest 7+ 4+

๐Ÿ“ผ Demos

Check our Demos.

๐Ÿ“– Documentation

See Documentation page.

๐Ÿ™Œ Contributing

See CONTRIBUTING.md.

๐Ÿ“ Feedback

Please file an Issue.

๐Ÿ›ฃ๏ธ Roadmap

See our Roadmap.

๐Ÿ“œ License

@egjs/flicking is released under the MIT license.

Copyright (c) 2015-present NAVER Corp.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

ย ย ย ย ย ย 

egjs-flicking's People

Contributors

arturovt avatar boxersb avatar daybrush avatar frewsxcv avatar gamtiq avatar greenkeeper[bot] avatar ha1fstack avatar hiuny avatar hyunsanghan avatar james-song avatar justforuse avatar malangfox avatar marco-adapttech avatar netil avatar parksb avatar rudyblack avatar sculove avatar seungdeok avatar taejs avatar uyeong avatar wlsdn2749 avatar woodneck avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

egjs-flicking's Issues

Adjust animation status on custom events

Description

The usual sequence of doing flickings are:

  • (1) touch's down & moving
  • (2) touch's up
  • (3) do Animation
  • (4) end of animation
  • (5) idle (after the flickEnd callback)

And illustrating above sequence with the moment which custom events fires are:
--- flick(1) --- beforeFlickStart(2) --- flick(3) --- flickEnd(4) --- idle (5) -->

Among those events, the isAnimaiting status values are:
--- false ----- true ------------------- true ------ true ---------- false ---->

The ideal of the animation status should be true only in phase (3), which animation is really happening.

So, the corrected isAnimating status should be as follows:
--- flick(1) --- beforeFlickStart(2) --- flick(3) --- flickEnd(4) --- idle (5) -->
--- false ----- false------------------- true ------ false ---------- false ---->

Incorrect outerHeight value on adaptiveHeight option

Description

Prior 2.x, adaptiveHeight option was getting panel's height value from jQuery's .outerHeight(true).
Which means, it should return element's height + padding + margin.

image

The current, is returning only the height + margin. It should sum padding value also.

egjs-flicking/src/utils.js

Lines 191 to 194 in 99ad635

getOuter(el, type) {
const style = window.getComputedStyle(el);
const margin = type === "outerWidth" ?
["marginLeft", "marginRight"] : ["marginTop", "marginBottom"];

Need more support for typescript

Description

eg.Flicking written by js, but have file supporting typescript. (flicking.d.ts)
But an update is required.

I use [email protected], it tell me some lint error.
error type is lacks return-type annotation

Steps to check or reproduce

  • used typescript compile option
"compilerOptions": {
        "allowJs": true,
        "sourceMap": true,
        "noImplicitAny": true
}
  • library usage
import * as Flicking from "@egjs/flicking";

// error TS7010: 'destroy', which lacks return-type annotation, implicitly has an 'any' return type
// `setStatus` method have same error

Remove outdated code

Description

Due to increase of performance device usages, function to determine isHWAccelerable isn't useful anymore.
Remove from the code base.

Ref #42

can't reference FlickingStatus interface

Description

I'm using [email protected] and [email protected]

currently getStatus function returns interface string | FlickingStatus.
If I want to reference status as FlickingStatus, I have to cast that like status as FlickingStatus or just reference them like below screenshot.

but actually none of that possible.

FlickingStatus is not exported and referencing status recognized as string.

casting
image
direct referencing
image

Introduce and adopt plugin system

Description

Introduce the way to plug with different effects or functionalities.

new eg.Flicking( ... )
    .plugin([
        new eg.Flicking.plugin.SomeEffect( ... ),
        ...
    ]);

diatance value

onflick ์ด๋ฒคํŠธ์—์„œ
moveTo, next, prev ๋ฉ”์†Œ๋“œ ํ˜ธ์ถœ์„ ํ†ตํ•ด ์ „ํ™˜์‹œ distance๊ฐ€ pos์™€ ๋™์ผํ•œ ๊ฐ’์ด ๋–จ์–ด์ง‘๋‹ˆ๋‹ค.
์ดํ›„ ์ˆ˜๋™์œผ๋กœ flicking ํ›„ ํ˜ธ์ถœ์‹œ ์ •์ƒ์ ์ธ ๊ฐ’์ด ๋–จ์–ด์ง‘๋‹ˆ๋‹ค.

Improve deployment process

Description

  • Get rid Jekyll (due to it makes tedious setup dev-env in windows)
  • Make gh-pages deployment as a shell script

A bug occurs when executing`resize` method

Description

A bug occurs when executingresize method in this module.

Details

eg-flick-conatiner_capture_image
eleemt-of-panel_capture_image

When resize occurs, reassigning the width value of the container. If the panels already constituting the container are responsive, the reassignment occurs, and the layout of the elements constituting the panel is not properly detected.

Steps to check or reproduce

  1. Click the link
  2. Open the Chrome Development Tool
  3. Click the rotate button.

Current behavior

current_behavior

Expected behavior

expected_behavior

  1. Click the rotate button again.

Current behavior

current_behavior_2

Expected behavior

expected_behavior_2

What about adding an option value for the responsive case?
Thx.

Intent to apply CSS containment

@netil commented on Fri Aug 05 2016

Description

For some components, can be useuful improving rendering cost with CSS containment property.
https://developers.google.com/web/updates/2016/06/css-containment

Try to find if it's applicable.


@netil commented on Wed Nov 16 2016

There're many behavioural causing side effects.
When panels are fixed size is worth to apply, but there's no guarantee of external(ex. intentional trigger) layout transformation.

Try research and look for more practical use cases of that spec. keeping this issue for later.

Not working after version update

destroy() ํ•œ๋ฒˆ ํ˜ธ์ถœ ํ•œ ์ดํ›„์—
์ƒˆ๋กœ this.f1 = new eg.Flicking ๊ฐ์ฒด ์ƒ์„ฑํ•˜๋ฉด ์—ฐ๊ฒฐ์ด ์•ˆ๋ฉ๋‹ˆ๋‹ค.

js๋กœ html ๊ทธ๋ฆฌ๊ณ 
๋‹ค๋ฅธ ๋ฉ”๋‰ด ์„ ํƒ์‹œ destroy๋กœ ์—ฐ๊ฒฐ ๋Š๊ณ  html ๋น„์šฐ๊ณ 
์ƒˆ๋กœ์šด ๋ฉ”๋‰ด์˜ html ๋‹ค์‹œ ๊ทธ๋ฆฌ๊ณ 
this.f1 = new eg.Flicking์œผ๋กœ ๋‹ค์‹œ ๊ทธ๋ฆฐ ๋ถ€๋ถ„ ์žก์•„์„œ
์ปจํŠธ๋กค ํ•˜๊ณ  ์žˆ์—ˆ์Šต๋‹ˆ๋‹ค.

// ํ•ด์ œ
itemUtil.flickingDestroy();

// ํ™”๋ฉด ๋‹ค์‹œ ๊ทธ๋ฆฌ๊ธฐ
var index = 0;
$.each(json_cate,function(k,v){
itemUtil.drawItem(k, index++);
});

// ๋‹ค์‹œ ๊ทธ๋ฆฐ ํ™”๋ฉด ์ปจํŠธ๋กค ํ•˜๊ธฐ ์œ„ํ•ด ์—ฐ๊ฒฐ
itemUtil.getFlicking();

// destroy ํ˜ธ์ถœ ํ›„ ๋‹ค์‹œ ์žก์œผ๋ฉด
// transform: translate(200%, 0px); ์ด ๊ฐ’ ์„ค์ •๋„ ์•ˆ๋จ.

์ด๋ ‡๊ฒŒ ๋™์ ์œผ๋กœ ํ˜ธ์ถœ ํ•  ๋•Œ๋Š” ์—๋Ÿฌ๊ฐ€ ๋‚˜๋Š”๋ฐ
getFlicking : function() {
start = ;

	this.f1 = new eg.Flicking("#mflick", {
	  duration : 100,
	  hwAccelerable : true,			
	  threshold : 20, 
	  circular: true
	}).on({
	  flickEnd: function(e) {
		itemUtil.selectMenu();
		itemUtil.setHeight();
	  }
	});
}
, flickingDestroy : function() {
	//log('flickingDestroy');
	$('.ssMenu').hide();

	this.f1.currentIndex = 0;
	this.selectMenu();
	this.f1.destroy();
	
	$('#mflick').empty();
}

ํŽ˜์ด์ง€๊ฐ€ ์ฒ˜์Œ ๋กœ๋“œ ๋  ๋•Œ๋Š” ์—๋Ÿฌ๊ฐ€ ์•ˆ๋‚ฉ๋‹ˆ๋‹ค.
$(document).ready(function(){
var index = 0;

$.each(json_cate,function(k,v){
	itemUtil.drawItem(k, index++);
});

itemUtil.getFlicking();
itemUtil.selectMenu();

//console.log("mainList li img : " + $(".mainList li img").height());

});

์—๋Ÿฌ-----------------------------------

Uncaught TypeError: Cannot read property 'destroy' of null
at PanInput.connect (flicking.pkgd.min.js:1)
at Axes.connect (flicking.pkgd.min.js:1)
at Flicking._bindEvents (flicking.pkgd.min.js:1)
at new Flicking (flicking.pkgd.min.js:1)

at HTMLAnchorElement.dispatch (jquery-1.11.3.min.js:4)
at HTMLAnchorElement.r.handle (jquery-1.11.3.min.js:4)

Update dependencies

Description

Update below dependencies:

  • egjs/component: 2.1.0
  • egjs/axes: 2.2.0

supports 'hold' event

user want to do something when touching on flicking.

flikcking.on("hold", function(e) {
   // do it!
});

Intent to ship 'previewPadding' in percent value.

@netil commented on Thu Aug 11 2016

Description

For previewPadding options, only px values are allowed.
To be responsible, it should be act on %(relative wrapper element) values too.

Steps to check or reproduce

 new eg.Flicking("#mflick", {
    previewPadding: [ "10%", "20%" ],
    circular: true
});

@netil commented on Mon Nov 14 2016

There's ambiguity on this.
If percentage values are given, what that values are based on?

  • Wrapper element
  • screen
  • viewport (in case of desktop this will be browser's size)

@netil commented on Thu Nov 17 2016

As a result on internal discussion,

  • wrapper is the base element
  • isn't must functionality for this moment, but will be useful providing

Keep for later shipment


@netil commented on Fri Mar 03 2017

Try implement on v2


@sculove commented on Thu Aug 03 2017

Issue moved to naver/egjs-flicking #19 via ZenHub

Prevent mal-minification loosing the intended context

Description

There're possibility of mal-minification of the this keyword used on private ._setMoveStyle() method.

The possible case is when user set pure_getters=true option using UglifyJS2 as minification tool.

Steps to check or reproduce

// current minified code
Flicking.prototype._setMoveStyle = function(t, e) {
    var n = l.TRANSFORM;

    this._setMoveStyle = n.support ? function(t, e) {
            var i;
            a.utils.css(t, ((i = {})[n.name] = a.utils.translate(e[0], e[1], this._conf.useLayerHack), i))
        } :
        function(t, e) {
            a.utils.css(t, {
                left: e[0],
                top: e[1]
            })
        }, this._setMoveStyle(t, e)  // <-- called in current context with the keyword 'this'
}

// reported mal-minification code
e.prototype._setMoveStyle = function(t, e) {
	var n = d.TRANSFORM;
	
        // it's wrapped with parenthesis, which returns a function and then called
        // in this case, there's no context and  'this' become undefined
	(this._setMoveStyle = n.support ? function(t, e) {
			var i;
			p.utils.css(t, (i = {},
			i[n.name] = p.utils.translate(e[0], e[1], this._conf.useLayerHack), i))
		}
		: function(t, e) {
			p.utils.css(t, {
				left: e[0],
				top: e[1]
			})
		}
	)(t, e)  // <-- there's no context in this call
}

how about ``forEach`` polyfill?

์•ˆ๋…•ํ•˜์„ธ์š”.
ie8 ์—์„œ egjs-flicking์„ ์‚ฌ์šฉํ•˜๋ ค๊ณ 
hammerjs-compatible
hammer
์˜ dependency๋ฅผ ๋งž์ถ”๋‹ˆ
forEach ๊ฐ€ ์—†์–ด์„œ ์—๋Ÿฌ๊ฐ€ ๋ฐœ์ƒํ•ฉ๋‹ˆ๋‹ค.

polyfill ํ•˜๋‹ˆ ๊ธฐ๋ณธ์ ์ธ ํ”Œ๋ฆฌํ‚น ๊ธฐ๋Šฅ์ด ie8์—์„œ๋„ ์ž˜ ์ž‘๋™ํ•˜๋Š”๋ฐ,
์•„์˜ˆ flicker์ฝ”๋“œ ๋‚ด์— polyfill์„ ํ•ด์„œ ie8 ํ•˜์œ„ ํ˜ธํ™˜์„ ๋งž์ถ”๋Š” ๊ฑด ์–ด๋– ์‹ ๊ฐ€์š”?

if (typeof Array.prototype.forEach != 'function') {
    Array.prototype.forEach = function(callback, thisArg) {
        if (typeof this.length != 'number') return;
        if (typeof callback != 'function') return;

        if (typeof this == 'object') {
            for (var i = 0; i < this.length; i++) {
                if (i in this) {
                    callback.call(thisArg || this, this[i], i, this);
                } else {
                    return;
                }
            }
        }
    };
}

pr ๋ฐ›์œผ์‹œ๋‚˜์š”?

Add DOM recycling usage feature

Description

In the real use cases, when needs to handle a massive panel elements, aren't recommended due to the performance decrease.

In that case dealing with a small number of DOM nodes and swap contents will be more effective.
Intent ship recyling DOM feature.

supports snapshot methods

Description

egjs-infiniteGrid supports snapshot method like setStatus and getStatus for using persist
I would like to provide a snapshot method at Flicking component like infiniteGrid.

ref : naver/egjs#443

Provide an option for the containerโ€™s z-index

Description

If there is an overlay layout using its z-index value as 100, we should reorganize the z-index values in order to use egjs-flicking since its containerโ€™s z-index value is 2000, which is pretty high.
Itโ€™d be good for various of use-cases if we can use an option such as containerZIndex.

An error occurs when constructing a Flicking module

Description

An error occurs when constructing a Flicking module

Steps to check or reproduce

I'm using webkacp v3.10.0, Typescript v2.6.2 and the code is as follows:

import * as Flicking from "@egjs/flicking";
const flicking = new Flicking(this.wrapper);

Error message:

2018-01-16 5 29 55
2018-01-16 5 30 01

Axes refer to /outjs/ when it's a module. However, index.js of /outjs/ seems to be generated from PanInput and it can't be referenced as a static property of Axes.

Fix code. but side-effects are expected So I wonโ€™t give you a PR.

// Flicking.js(@egjs/flicking)
import Axes, {PanInput} from "@egjs/axes";

In order to using tree-shaking

Description

Axes supports ES6 Module for Tree-shaking.
if you want to use latest version of @egjs/axes, you should change code following like

AS-IS (before @egjs/axes v2.4.2)

import Axes from "@egjs/axes";

// new Axes()
// new Axes.PanInput()

TO-BE (after @egjs/axes v2.4.2)

import Axes, {PanInput} from "@egjs/axes";

// new Axes()
// PanInput()

on PC...

ํ”Œ๋ฆฌํ‚น ui ์“ฐ๋ฉด PC์—์„œ ๋ณผ๋•Œ ์ด๋ ‡๊ฒŒ ๋ณด์ž…๋‹ˆ๋‹ค.
If I use Flicking ui , it looks like this below picture on PC

d

Remove physical panel number terminology

Description

In some circumstances, panels are duplicated due to maintain the usability.
Ex. when there's a panel, to make flickable, it duplicates to be 3.
In that case, logically there's a panel, but physically there're 3 panels.

This approach was quite reasonable at the first time, but it's giving confusion and isn't really used normally.
Get rid the confusion physical on API calls.

Look for improve usage of adaptiveHeight option

Description

Current implementation of adaptiveHeight option is for static DOM panels, which are defined at the time of the initialization.

When panel elements are updated dynamically, the height's value needs to be updated as well.
Look for a better way to handle this.

unexpected restore event firing

Description

restore custom event is fired inappropriately in specific occasion.

Steps to check or reproduce

  • Do touch moves of panel, but to be restored
  • Call .next/prev/moveTo with duration
  • unexpected restore event is fired after flickEnd event

Intent to ship 'previewPadding' in percent value.

@netil commented on Thu Aug 11 2016

Description

For previewPadding options, only px values are allowed.
To be responsible, it should be act on %(relative wrapper element) values too.

Steps to check or reproduce

 new eg.Flicking("#mflick", {
    previewPadding: [ "10%", "20%" ],
    circular: true
});

@netil commented on Mon Nov 14 2016

There's ambiguity on this.
If percentage values are given, what that values are based on?

  • Wrapper element
  • screen
  • viewport (in case of desktop this will be browser's size)

@netil commented on Thu Nov 17 2016

As a result on internal discussion,

  • wrapper is the base element
  • isn't must functionality for this moment, but will be useful providing

Keep for later shipment


@netil commented on Fri Mar 03 2017

Try implement on v2

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.