naver / egjs-flicking-plugins Goto Github PK
View Code? Open in Web Editor NEWPlugins for @egjs/flicking
Home Page: https://naver.github.io/egjs-flicking/Plugins
License: MIT License
Plugins for @egjs/flicking
Home Page: https://naver.github.io/egjs-flicking/Plugins
License: MIT License
After the recent Vue3 update, it renders pretty well on my side with the latest version of Vue. However, the autoplay plugin for this instance only does one tick before it stops. i don't see any console errors so I'm assuming it is something with this plugin for Vue3.
Attaching a codesandbox template that I replicated the issue on.
https://codesandbox.io/s/holy-morning-5otoz?file=/src/App.vue
When the number of panels is small in the Circular state, parallax causes strange behavior.
If there is one panel, the movement of the image occurs.
export interface Plugin {
init(flicking: Flicking): void;
update?(flicking: Flicking): void;
destroy(flicking: Flicking): void;
}
When using the custom classes on the renderBullet
, it doesn't show after it's rendered.
classes => `<span class="test ${classes}"></span>`
Experiencing some odd behaviour with this;
If I have 4 panels and use moveType: 'strict'
(1 panel at a time), clicking the 1st bullet when I'm on the 4th panel flicking flicks to the 3rd panel, but the 1st bullet becomes the "active" one.
Changing to moveType: 'snap'
fixes the issue, but I prefer the UX of 'strict'
for my case.
Should be pretty easy to reproduce, but in case it isn't, my context is
Vue3 in Google Chrome Version 100.0.4896.88 (Official Build) (64-bit) on Arch Linux
Not an issue, more of a suggestion for ease-of-access and maintainability.
For reference, my use-case is that I'm making a Vue3+TS single-file "Carousel" component, and I want to control the <Flicking>
component's plugins
prop, with props for my <Carousel>
// <script setup lang="ts">
import { defineProps, computed, PropType } from "vue";
// What I want to do:
// import { Pagination, PaginationOptions, Arrow, ArrowOptions, ... } from "@egjs/flicking-plugins";
// What I'm doing:
// interface PaginationOptions {
// parentEl: HTMLElement | null,
// ...copy everything from the PaginationOptions in this repo
// }
// interface ArrowOptions { ... }
// interface FadeArguments { ...Β }
// and so on
const props = defineProps({
pagination: { type: Object as PropType<Partial<PaginationOptions> | null>, default: null },
// same idea for arrows, autoplay, fade, parallax, sync
});
const plugins = computed(() => {
return [
props.pagination && new Pagination(props.pagination),
// props.arrow && new Arrow(props.arrow), and so on
];
})
so that I can instantiate my Carousel
component like this
<!-- Use default Pagination plugin options -->
<Carousel :pagination="{}">
<!-- Don't use the Pagination plugin-->
<Carousel>
<!-- Use Pagination plugin and overwrite some default pagination options -->
<Carousel :pagination="{ type: 'fraction' }">
Add option for stop auto play when mouse on slider
<script src="https://unpkg.com/@egjs/[email protected]/dist/flicking.pkgd.min.js"></script>
<script src="https://naver.github.io/egjs-flicking-plugins/release/latest/dist/plugins.min.js"></script>
<link rel="stylesheet" href="https://naver.github.io/egjs-flicking-plugins/release/latest/dist/flicking-plugins.css">
<link rel="stylesheet" href="https://unpkg.com/@egjs/[email protected]/dist/flicking.css">
<script>
const flicking = new Flicking("#Carousel", {align: "center", circular: true, bound: true, renderOnlyVisible: true, useFractionalSize: true, align: "prev"})
flicking.addPlugins(new Arrow());
</script>
Arrow is not defined.
How can use arrow plugin by CDN?
Just a suggestion. Would love to be able to control this plugin a bit more (e.g. stopping on a specific index, stopping on focus inside panel, etc) instead of just stopping on hover π
typeκ° μ€ bullet
κ³Ό fraction
μ UIμ ννλ₯Ό ꡬλΆνμ¬ μ§μ΄μ§ μ΄λ¦μΈλ° λ°ν΄, scroll
μ ννκ° μλ κΈ°λ₯ μΌλΆ('bullet' νμ
μΈλ° bullet λͺ κ°λ§ νμ, ν¨λ indexμ λ°λΌ bullet 컨ν
μ΄λλ₯Ό μ€ν¬λ‘€ν¨)μ μ΄μ μ΄ λ§μΆ°μ§ μ΄λ¦μ΄λ―λ‘ bullet
νμ
μ μΈλΆ μ΅μ
μΌλ‘ μ μλλ κ²μ΄ μ’ λ μμ°μ€λ¬μ΄ κ² κ°μ 보μ
λλ€. μμ μ½λλ μ½λ1 μ μ°Έμ‘° λΆνλ립λλ€.
Among the type values, bullet
and fraction
are names that distinguish the shape of the UI, whereas scroll
is a part of a function rather than a shape ('bullet' type, but only a few bullets are displayed, and the bullet container is scrolled according to the panel index) ), so it seems more natural to be defined as a detailed option of type bullet
. For example code, please refer to Code 1.
μ½λ1 - bullet
νμ
μ μΆκ° νλΌλ―Έν° μ μ μμ
Code 1 - Example of defining additional parameters of bullet
type
new Pagination({
type: 'bullet',
param: {
// νμν bullet κ°μ. μλ΅μ μ 체 νμ. μ 체 κ°λ³΄λ€ ν΄ μ μκ³ , 0μ΄ν κ° μ§μ μ bullet λΉνμ
display: 5,
// bulletμ ννλ₯Ό κ²°μ νλ κ°. A, Bλ μμλ‘ μ§μ ν κ°μ΄λ©° ν΄λΉ bulletννλ₯Ό λ μ μ€λͺ
νλ λ¨μ΄λ‘ λ체λ μ μμΌλ©° νμμ μλ‘μ΄ νμ
μ μ μλ κ°λ₯ν©λλ€.
// 'A': νμ¬ Pagination bullet λ°λͺ¨μ λμΌν νν. μ€κ° indexμΌ λλ§ display κ°μ λ
ΈμΆ 보μ₯. μ²μκ³Ό λ λΆλΆμμ ν λκ°κ° μ μ μ μμ
// 'B': νμ display κ°μ λ§νΌμ λ
ΈμΆμ 보μ₯. μ€κ° indexμΌ λλ νμ 1λ² 5λ² bulletμ΄ μκ² νμλ¨. μ²μκ³Ό λμΌ λλ κ°κ° μ΅μ°μΈ‘κ³Ό μ΅μ’μΈ‘ bulletμ΄ μκ² νμλ¨
shape: 'A'
},
});
μ€ν¬λ¦°μ·1 - Pagination μμ±μμ type μ΅μ
Screenshot 1 - type option in Pagination constructor
μλ
νμΈμ, Flicking AutoPlay μ¬μ© μ€μ QAκ° λ°μνμ¬ λ¬Έμλ립λλ€.
ν΄λΉ νλ¬κ·ΈμΈ μ¬μ© μ λ¨λ§κΈ° μκ°μ λ³κ²½ν ν λ€μ μ κ·Όνμλ νλ¦¬νΉ μμμ΄ λΉ λ₯΄κ² λμ΄κ°λ νμμ΄ μλμ κ°μ΄ λ°μνκ³ μμ΅λλ€.
νΉμ ν΄λΉ νμ μμ μ΄ κ°λ₯ν μ§ λ¬Έμλ립λλ€ πββοΈπββοΈ
κ°μ¬ν©λλ€
I face the problem about Arrow and Pagination(Bullet) plugin. It has to click two times to move panel.
I created a sample project on Codesandbox. You could check on this link.
@egjs/flicking-plugins: 4.1.0
@egjs/vue-flicking: 4.1.2
vue: 2.6.11
Open the website from this project, and click to navigate panel by clicking on arrow or bullet.
I'm trying to reach a marquee effect. My configuration is working fine and smooth. The only issue I encountered is when I hover the slider it gets paused correctly but only when it reaches the next slide, aka I would like to have the possibility to interrupt the animation while slide is actually changing. In the video below you can see the behaviour of the bottom slider (flicking) and the top slider (another library - splidejs -):
I would like to have the same pause behaviour of the top slider. Also this Splide plugin has some performance issues so I would like to switch to flicking if possible.
Svelte
import Flicking, { FlickingPanel } from '@egjs/svelte-flicking';
import { AutoPlay } from '@egjs/flicking-plugins';
import '@egjs/svelte-flicking/dist/flicking.css';
let flicking: Flicking;
const plugins = [
new AutoPlay({ duration: 0, animationDuration: 3000, direction: 'NEXT', stopOnHover: true })
];
<Flicking
bind:this={flicking}
{plugins}
hideBeforeInit={true}
firstPanelSize="16rem"
options={{
align: 'center',
circular: true,
easing: (x) => x,
interruptable: true,
autoResize: true,
moveType: 'freeScroll'
}}
>
{#each slides as slide, i}
<FlickingPanel class="h-36 !w-64 !mb-8">
CONTENT
</FlickingPanel>
{/each}
</Flicking>
How to create custom plugins, like a scaling only plugin rather than perspective + scaling
μλ
νμΈμ. AutoPlay νλ¬κ·ΈμΈμ μ¬μ©νλ μ€ κΆκΈν μ μ΄ μ겨 μ§λ¬Έ λ립λλ€.
durationμ μ λλ©μ΄μ
μμ ν΄λΉ νμ΄ μ μ§λλ μκ°μ΄λΌκ³ μ΄ν΄νλλ°μ.
νΉμ λ€μ νκΉμ§ μ΄λνλλ°μ 걸리λ μκ°(speed)λ₯Ό μ‘°μ ν μ μλ parameterκ° μμκΉμ?
κ°μ¬ν©λλ€.
As far as I can tell, both Arrow and Bullet plugins are the only ones that listen for the touchstart event. This event should be a passive listener to improve scrolling performance per Lighthouse and https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md. It does not look like these listeners use preventDefault(), only stopPropagation(), so it shouldn't be too much of a change.
Hammer.js also exhibits this problem, though I don't know what is calling hammer's addEventListener function
I modified the dist files locally and don't see any regressions.
I can produce one if needed
Component render empties the bullets container. If no re-render appears, the plugin works well. But if state change causes component re-render then bullets disappear.
The situation happens in React.js.
const flickingRef = useRef<Flicking | null>(null);
const plugins = [new Pagination({ type: "bullet" })];
const [isMoving, setIsMoving] = useState(false);
const handleMoveStart = () => {
setIsMoving(true);
};
const handleMoveEnd = () => {
setIsMoving(false);
};
<Flicking
ref={flickingRef}
circular={true}
align="prev"
onMove={handleMoveStart}
onMoveEnd={handleMoveEnd}
plugins={plugins}
>
<div className="recommendation-box">
container1
</div>
<div className="recommendation-box">
container2
</div>
<div className="recommendation-box">
container3
</div>
<div className="recommendation-box">
container4
</div>
<ViewportSlot>
<div className="flicking-pagination"></div>
</ViewportSlot>
</Flicking>
When onMove and onMoveEnd handlers modify state, causing component rerender, then
<div class="flicking-pagination flicking-pagination-bullets">
<span class="flicking-pagination-bullet flicking-pagination-bullet-active"></span>
<span class="flicking-pagination-bullet"></span>
<span class="flicking-pagination-bullet"></span>
<span class="flicking-pagination-bullet"></span>
</div>
becomes
<div class="flicking-pagination flicking-pagination-bullets"></div>
I have the problem that the arrows do not go by themselves, one step forward or back. Also, the arrows can be dragged so that it can move. (see video)
Documentation I followed: https://naver.github.io/egjs-flicking/Plugins
<script setup lang="ts">
import Flicking from "@egjs/vue3-flicking";
import {Arrow} from "@egjs/flicking-plugins";
const plugins = ref([new Arrow()]);
function test() {
console.log('button works')
}
</script>
<template>
<Flicking
ref="swiper"
:plugins="plugins"
:options="{ circular: true }"
class="w-full h-full"
>
<div
class="h-full w-full flex bg-cover rounded-md"
:key="img.id"
v-for="img in resort.media"
:style="`background: url('${img.original_url}'); background-size: cover;`"
>
</div>
<template #viewport>
<span @click="test" class="flicking-arrow-prev"></span>
<span class="flicking-arrow-next"></span>
</template>
</Flicking>
</template>
<style scoped>
@import url("@egjs/vue3-flicking/dist/flicking.css");
@import url("@egjs/flicking-plugins/dist/flicking-plugins.css");
@import url("@egjs/flicking-plugins/dist/arrow.css");
</style>
{
"types": "./index.d.ts",
}
{
"types": "./declaration/index.d.ts",
}
Version I use :
"@egjs/flicking-plugins": "^4.2.1",
"@egjs/ngx-flicking": "^4.3.0",
I tried the pagination plugin as described in the document, but it is not rendered.
I found that DOM has been created, but the height is 0, and the font-size of each bullet is 0 as well.
However, when I set the type as "fraction", it worked just fine.
Currently there's no way for users to programmatically play and stop autoplay.
Version I use :
"@egjs/flicking-plugins": "^4.2.1",
"@egjs/ngx-flicking": "^4.3.0",
Hello, @WoodNeck !
It seems like that AutoPlay doesn't work when there are multiple flickings.
Here I attach my code snippets below:
https://codesandbox.io/s/nifty-moon-fu0fx?file=/src/app/app.component.html
And sometimes I found that the multiple autoplay works when I resize the browser window, but I couldn't reproduce this symptom in the demo.
By the way, I really enjoy your work here! Thank you for this awesome component.
plug-inκ°λ°μ μν μ°Έμ‘° λ¬Έμκ° μλ κ² κ°μ΅λλ€. 컀μ€ν plug-inμ κ°λ° νΉμ κΈ°μ‘΄ κ°λ°λ plug-inμ 컀μ€ν°λ§μ΄μ§λ±μ μν΄μλ κ΄λ ¨ λ΄μ©μ΄ μ 리λ λ¬Έμκ° νμν©λλ€. λ¬Έμ μ μ λΆνλ립λλ€.
There seems to be no reference documentation for plug-in development. In order to develop a custom plug-in or to customize an existing plug-in, a document with related contents is required. Please create a document.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.