Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

media-viewer

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

media-viewer

Image/video viewer

  • 1.2.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5
Maintainers
1
Weekly downloads
 
Created
Source

media-viewer

image/video viewer

npm install media-viewer --save-dev
# or
npm i media-viewer -D
import { MediaViewer } from 'media-viewer'

let arr = [
  {
    thumb: './1.jpg',
    url: './1.mp4',
    type: 2
  },
  {
    thumb: './2.jpg',
    url: './2.jpg',
    type: 1
  }
]

// 参数配置
let options = {
  // ...
}
// 实例化
let mv = new MediaViewer(options, arr)

setTimeout(_ => {
  // 查看第一个元素
  mv.view(0)
}, 2000)

options 参数

参数类型必须说明
errorFunction错误通知
showPaginationBoolean显示pagination, 默认true
paginationEventString触发切换图片事件名称, 默认'mouseover'
showThumbBoolean显示缩略图, 默认true
thumbPositionString缩略图显示位置top/bottom, 默认bottom
closeOnClickMaskBoolean点击空白处关闭窗口, 默认true

methods 方法

  • view(index, newMediaArray)

    index: Number, 必须。查看第index + 1张图片或视频。

    newMediaArray: Array, 可选。新的媒体url数组。

Keywords

FAQs

Package last updated on 20 Nov 2018

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