All Projects → gu-fan → vue-edge-check

gu-fan / vue-edge-check

Licence: MIT license
Check Browser Edge Reactively✨

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to vue-edge-check

drawer
A touch-enabled drawer component for the modern web.
Stars: ✭ 26 (-10.34%)
Mutual labels:  swipe-gestures
SSJetpackComposeSwipeableView
SSJetpackComposeSwipeableView is a small library which provides support for the swipeable views. You can use this in your lazyColumns or can add a simple view which contains swipe to edit/delete functionality.
Stars: ✭ 57 (+96.55%)
Mutual labels:  swipe-gestures
gestures
A library for normalized events and gesture for desktop and mobile.
Stars: ✭ 31 (+6.9%)
Mutual labels:  swipe-gestures
iron-swipeable-pages
[Polymer 1.x] Element that enables switching between different pages by swiping gesture.
Stars: ✭ 51 (+75.86%)
Mutual labels:  swipe-gestures
Slidr
Easily add slide to dismiss functionality to an Activity
Stars: ✭ 2,622 (+8941.38%)
Mutual labels:  swipe-gestures
v-cupertino
A Vue 3 Wrapper for Cupertino Pane Library
Stars: ✭ 17 (-41.38%)
Mutual labels:  swipe-gestures

vue-edge-check

English / 中文

Check Browser Edge Reactively.To prevent transition effect triggered oddly when swipe edge with vue-router

Before

Odd Effect

After

Good Effect

Why & How ?

You can swipe with edge gesture in iOS Safari/WKWebview/Wechat. The page will trigger history.back()/history.forward() after the page is sliding finished. then the transition animation of router will still triggering, that's redundant.

So we can check if we touch the edge when move back/forward, then block current transition effect

Page

Install

npm install vue-edge-check

OR

yarn add vue-edge-check

Useage

Two Propery $isEdgeLeft$isEdgeRight, Means touching left edge or right edge of page

can be used to define class in components

import and use

import EdgeCheck from 'vue-edge-check'
Vue.use(EdgeCheck)

define class

<template>
  <transition name="slide">
    <div class="test" :class="{'is-edge-back':$isEdgeLeft,'is-edge-forward':$isEdgeRight}">
      <h1>
          TEST
      </h1>
    </div>
  </transition>
</template>

define / block transition effect

// ORIGIN: set slide transition effect time
.slide-enter-active, .slide-leave-active {
  transition: all 0.3s;
}

// ORIGIN: add slide transition effect
.slide-enter,
.slide-leave-to
{
  transform: translate3d(100%, 0, 0);
}

// EXTRA: this component should have no transition with edge forward/back
.is-edge-forward.slide-enter-active,
.is-edge-back.slide-leave-active
{
  transition: all 0s;
}

// EXTRA: this component should not display at slide-leave start
// or else it will blink
.is-edge-back.slide-leave,
{
  transform: translate3d(100%, 0, 0);
}

// EXTRA: this component should display and not move at slide-enter start
// or else it will jump
.is-edge-forward.slide-enter,
{
  transform: translate3d(0, 0, 0);
}

Options

edge_width: default: 48

the width of edge check

edge_duration: default: 500

the $isEdgeLeft/$isEdgeRight property lasting time, need a bit more than transition effect time

// in case if you have a longer transition effect
Vue.use(EdgeCheck, {edge_duration:1000})
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].