Getting Started Introduction
Getting Started Gulp
Getting Started Customization
Getting Started Credits
Getting Started Changelog
Content Typography
Content Bootstrap Icons
Components Accordion
Components Alerts
Components Avatars
Components Badge
Components Banners
Components Breadcrumb
Components Buttons
Components Cards
Components Collapse
Components Column divider
Components Devices
Components Divider
Components Dropdowns
Components List Group
Components Lists
Components Modal
Components Offcanvas
Components Pagination
Components Popovers
Components Progress
Components Shapes
Components Sliding Image
Components Spinners
Components Steps
Components Tab
Components Tables
Components Toasts
Components Tooltips
Navbars Navbar
Navbars Navs
Navbars Mega Menu
Navbars Scrollspy
Basic forms Basic forms
Basic forms Checks and switches
Basic forms Input group
Utilities Backgrounds
Utilities Borders
Utilities Colors
Utilities Colored links
Utilities Links
Utilities Position
Utilities Shadows
Utilities Sizing
Utilities Spacing
Utilities Z-index
Media Fullscreen Lightbox
Media Swiper
Others Sticky block
Others Countdown
Others Video Background
Others Go To
Image Description

No Results

  • Get Support
  • Preview Demo
  • Docs
  • Snippets
  • Documentation
  • Introduction
  • Getting started
  • Getting Started
  • Gulp
  • Customization
  • Credits
  • Changelog
  • Design & Graphics
  • Bootstrap Icons
  • Components
  • Accordion
  • Alerts
  • Avatars
  • Badge
  • Breadcrumb
  • Buttons
  • Cards
  • Collapse
  • Column Divider
  • Devices
  • Divider
  • Dropdowns
  • List Group
  • Lists
  • Modal
  • Offcanvas
  • Pagination
  • Popovers
  • Progress
  • Shapes
  • Sliding Image
  • Spinners
  • Steps
  • Tab
  • Tables
  • Toasts
  • Tooltips
  • Typography
  • Navbars
  • Navbar
  • Navs
  • Mega Menu
  • Scrollspy
  • Basic forms
  • Basic Forms
  • Checks & Switches
  • Input Group
  • Media
  • Fullscreen Lightbox
  • Swiper Touch Slider
  • Others
  • Sticky Block
  • Countdown
  • Video Background
  • Go To
  • Utilities
  • Backgrounds
  • Borders
  • Colors
  • Links
  • Position
  • Shadows
  • Sizing
  • Spacing
  • Z-index

Video Background

Creates responsive video or slideshow embeds based on the width of the parent by making an intrinsic ratio that scales on any device.

How to use

Copy-paste the stylesheet <link> into your <head> to load the CSS.

<link rel="stylesheet" href="./assets/vendor/hs-video-bg/dist/hs-video-bg.min.css">
Copy

Copy-paste the following <script> near the end of your pages under JS Implementing Plugins to enable it.

<script src="./assets/vendor/hs-video-bg/dist/hs-video-bg.min.js"></script>
Copy

Copy-paste the init function under JS Plugins Init., before the closing </body> tag, to enable it.

<script>
  (function() {
    // INITIALIZATION OF VIDEO BACKGROUND
    // =======================================================
    $('.js-video-bg').each(function () {
      var videoBg = new HSVideoBg($(this)).init();
    });
  })()
</script>
Copy

YouTube

  • Preview
  • HTML
<!-- Video Bg -->
<div class="video-bg">
  <div class="js-video-bg video-bg-content"
       data-hs-video-bg-options='{
         "type": "you-tube",
         "videoId": "d4eDWc8g0e0",
         "ratio": 0.75
       }'>
  </div>
</div>
<!-- End Video Bg -->
Copy

Vimeo

  • Preview
  • HTML
<!-- Video Bg -->
<div class="video-bg">
  <div class="js-video-bg video-bg-content"
       data-hs-video-bg-options='{
         "type": "vimeo",
         "videoId": "412471131",
         "ratio": 0.75
       }'>
  </div>
</div>
<!-- End Video Bg -->
Copy

HTML5

  • Preview
  • HTML
Your browser doesn't support HTML5 video.
<!-- Video Bg -->
<div class="video-bg">
  <div class="js-video-bg video-bg-content"
       data-hs-video-bg-options='{
         "videoId": "../assets/video/our-business-is-growing"
       }'>
  </div>
</div>
<!-- End Video Bg -->
Copy

Methods

Parameters Description Default value

type

Type of video. Valid Values: you-tube, vimeo and default 'default'

videoId

For you-tube and vimeo video ID, for default - the relative path to the video files on the server null

isLoop

Determines whether the video will be played cyclically or once true

ratio

Determines the aspect ratio of the video 1.5