pxs-video v2.4.1
PXS Video
A video section built for Shopify that supports Youtube and Vimeo
Table of contents
Getting started
Installation
First we'll need to add pxs-video
as a theme dependency:
npm install pixelunion/pxs-video
The line above will include the pxs-video
package as a dependency to our theme. We can then use Paskit to add the section to our build folder.
If you deploy the theme, you will see that the section shows up as Video
under the Video
category.
Including styles
Now that we've got our section added to our build folder, we'll need to include the styles in our theme. We can do this by adding the following line to our SCSS.
@import "path/to/node_modules/pxs-video/src/styles/pxs-video";
Including scripts
Now that we've got the pxs-video
styles in our theme, we can use the following line to import the Javascript
import PxsVideo from 'pxs-video';
Then all we need to do is register the section like it's any other section:
sections.register('pxs-video', section => new PxsVideo(section));
Styles
Variables
All of the following variable values are set as !default
meaning we can change the value of these variables anywhere in our code. This is different than standard SCSS variables where we would have to change the variable after it is declared.
Name | Default value |
---|---|
$pxs-video-heading-font-size | 34px |
$pxs-video-text-font-size | 24px |
$pxs-video-overlay-heading-font-size | 24px |
$pxs-video-overlay-text-font-size | 18px |
$pxs-video-overlay-style-primary | #000 |
$pxs-video-overlay-style-secondary | #fff |
Scripts
Included with pxs-video
are 4 different builds of the Javascript. These builds can be found in the dist
folder.
Filename | Purpose |
---|---|
index.js | Vanilla javascript |
index.es.js | Compiled to support ES6 |
index.umd.js | Supports both CommonJS and AMD |
index.umd.min.js | Minified version of UMD |
Settings
Label | ID | Type | Values | Default |
---|---|---|---|---|
Heading | title | text | N/A | Video |
Text | text | richtext | N/A | <p>Enhance your home page with a video that relates to your process, products, or story.</p> |
YouTube or Vimeo link | video | video_url | N/A | https:// www.youtube.com /watch?v= _9VUPq3SxOc |
Aspect ratio | aspect_ratio | select | 16:9 = "16-9" 21:9 = "21-9" | 16-9 |
Autoplay | autoplay | checkbox | N/A | false |
Mute video at start | start_muted | checkbox | N/A | true |
Show overlay | overlay_show | checkbox | N/A | false |
Heading | overlay_heading | text | N/A | Video |
Text | overlay_text | richtext | N/A | <p>Enhance your home page with a video that relates to your process, products, or story.</p> |
Heading and text position | overlay_header_position | select | Above button = above-button" Below button = "below-button" | above-button |
Text color | overlay_header_color | color | N/A | #FFFFFF |
Background color | overlay_color | color | N/A | #000000 |
Background color opacity | overlay_color_opacity | range | N/A | 50 |
Image | overlay_image | image_picker | N/A | N/A |
Button style | overlay_button_style | select | Primary = "primary" Secondary = "secondary" | primary |