项目作者: FabricElements

项目描述 :
Focal point for your images
高级语言: HTML
项目地址: git://github.com/FabricElements/skeleton-focal.git
创建时间: 2017-08-18T16:09:13Z
项目社区:https://github.com/FabricElements/skeleton-focal

开源协议:BSD 3-Clause "New" or "Revised" License

下载


Build Status Published on webcomponents.org Published on Vaadin  Directory

\

skeleton-focal is a Polymer 3 element that provides a focal point for your images.
Allows you to drag the focal point and returns the value in attributes that reflects the selected x and y coordinates in a 0-1 range.

  1. <dom-bind>
  2. <template>
  3. <skeleton-focal
  4. src="https://source.unsplash.com/random/800x400"
  5. x="{{x}}"
  6. y="{{y}}"></skeleton-focal>
  7. <h4>Focal point coordinates</h4>
  8. <ul>
  9. <li><strong>X:</strong> [[x]]</li>
  10. <li><strong>Y:</strong> [[y]]</li>
  11. </ul>
  12. </template>
  13. </dom-bind>

Installation

Install skeleton-focal with npm

  1. $ npm install FabricElements/skeleton-focal --save

Usage

Import it into the <head> of your page

  1. <script type="module" src="node_modules/@fabricelements/skeleton-focal/skeleton-focal.js"></script>

Example: basic usage

  1. <skeleton-focal src="image.jpg" x="{{x}}" y="{{y}}"></skeleton-focal>
  • src (string) - The URL of an image.
  • x (number) - attribute that reflects the selected x coordinate in a 0-1 range.
  • y (number) - attribute that reflects the selected y coordinate in a 0-1 range.

Other attributes

  • loaded (boolean) - Read-only value that is true when the image is loaded.
  • crossorigin (string) - CORS enabled images support: https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image
  • placeholder (string) - This image will be used as a background/placeholder until the src image has loaded. Use of a data-URI for placeholder is encouraged for instant rendering.
  • preventLoad (boolean) - When true, the image is prevented from loading and any placeholder is shown. This may be useful when a binding to the src property is known to be invalid, to prevent 404 requests.

Contributing

Please check CONTRIBUTING.

License

Released under the BSD 3-Clause License.