项目作者: tessahelenmartin

项目描述 :
A lightweight library with tools to support and create SVG images
高级语言: JavaScript
项目地址: git://github.com/tessahelenmartin/vivid-ui.git
创建时间: 2017-08-01T17:17:33Z
项目社区:https://github.com/tessahelenmartin/vivid-ui

开源协议:

下载


vivid-ui-logo

vivid-ui

A lightweight library to support and enhance SVG images

Usage

Magnify function

To use the magnify function, you simply have to pass a config object in the following fashion:

  1. vividUI.magnify({
  2. fileName: "/assets/puppy.jpg", // Path to the image to magnify
  3. parentSelector: "#puppydiv", // Selector for the div to place the image in, must have a height
  4. // and width
  5. magnifyRadius: 75, // Radius of magnified area
  6. magnifyFactor: 3 // Factor of magnification- ie. 3x larger than the size of the
  7. // parent div
  8. })

Parallax function

There are two options for using the parallax function. The first displays only one image with parallax:

  1. this.vividUI.parallax({
  2. parentSelector: "#puppydiv", // Selector for the div to place the image in, must have a height
  3. // and width
  4. targetSelector: "#targetdiv", // Selector for the object we use as a reference point for parallax
  5. fileName: "/assets/puppy.jpg", // Path to the image to use in parallax
  6. scrollRate: 1.5, // Rate of scroll- determines the height of the image and the
  7. // translation per unit scrolled
  8. scrollAxis:"y", // Scroll axis in which the parallax will be triggered (optional)
  9. imageAxis:"y", // Axis in which the image will be translated
  10. offsetBegin:true, // Determines if there is an offset from the top- if false or not
  11. // set, parallax begins when the top of the target div reaches
  12. // the top of the viewport; if true, parallax begins when the
  13. // top of the target div reaches the bottom of viewport
  14. offsetEnd:false // Determines if there is an offset from the bottom- if false or
  15. // not set, parallax ends when the bottom of the target div
  16. // reaches the top of the viewport; if true, parallax ends when
  17. // the bottom of the target div reaches the bottom of viewport
  18. })

The second overlays multiple images with parallax:

  1. this.vividUI.parallax({
  2. parentSelector: "#puppydiv", // Selector for the div to place the image in, must have a height
  3. // and width
  4. targetSelector: "#targetdiv", // Selector for the object we use as a reference point for parallax
  5. layerImages: true, // Denotes that this is a layered parallax image
  6. layerFileNames:[ // Array of paths to the images to be used as layers
  7. "/assets/first.svg",
  8. "/assets/second.svg",
  9. "/assets/third.svg",
  10. "/assets/fourth.svg"
  11. ],
  12. scrollAxis:"y", // Scroll axis in which the parallax will be triggered
  13. imageAxis:"y", // Axis in which the image will be translated
  14. offsetBegin:true, // Determines if there is an offset from the top- if false or not
  15. // set, parallax begins when the top of the target div reaches
  16. // the top of the viewport; if true, parallax begins when the
  17. // top of the target div reaches the bottom of viewport
  18. offsetEnd:false // Determines if there is an offset from the bottom- if false or
  19. // not set, parallax ends when the bottom of the target div
  20. // reaches the top of the viewport; if true, parallax ends when
  21. // the bottom of the target div reaches the bottom of viewport
  22. })