New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

anima-focuser

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

anima-focuser

Focus transform for Anima.

  • 2.0.0
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

anima-focuser spm version


焦点转换组件


Focuser 继承了 widget,可使用其中 baseclasseventsattributeaspect 的属性和方法。

72帧大片

preview

安装

$ spm install anima-focuser --save

快速使用

HTML:
<div class="focuser-wrapper" id="J-wrapper1">
    <div class="focuser-box">
        <div class="focuser-card">Pink</div>
        <div class="focuser-card">Yellow</div>
        <div class="focuser-card">Green</div>
        <div class="focuser-card">Red</div>
        <div class="focuser-card">Blue</div>
    </div>
</div>
Javascript:
var Focuser = require('anima-focuser');

var focuser = new Focuser({
    wrapper: '#J-wrapper1'
});

API

属性

wrapper String DOMElement Zepto-object

包裹的层,可以是选择器、DOM 节点或者 Yocto(Zepto) 对象

trigger String

滑动触发区域,只有两个值可选,wrapper 代表最外层,focus 代表当前焦点卡片,默认是 wrapper

注意:选择 focus 后,将只在当前焦点卡片上滑动才会有效果

minDisplacement Number

触发滑动的最小距离,默认 30 像素

如果想要移动任意距离时就产生滑动效果,可以设置为 0

方法

forward

向前翻到下一个焦点卡片 focuser.forward()

backward

向后翻到上一个焦点卡片

getCurrent

获得当前焦点的卡片

事件

beforeArrange

重排触发之前 focuser.on('beforeArrange', function(e) { ... })

afterArrange

重排触发之后

afterPrevTap

前一卡片轻击后

如果想要在点击前一张卡片之后滑动到焦点卡片位置,可以这样使用:

focuser.on('afterPrevTap', function() {
    focuser.backward();
});

点击后一张卡片同理

afterNextTap

后一卡片轻击后

afterCurrentTap

当前卡片轻击后

afterWrapperTap

包裹外层轻击后

外观

修改卡片宽度、高度、间距、动画参数等,可以按 CSS 类名自定义样式去覆盖原来样式

Keywords

FAQs

Package last updated on 12 Jun 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc