Great module :)

What do you think about adding the following features?

  • Limiting the nodes on which the video background appears, e.g. only the home page?
  • Providing the option to display the background holding image first if viewing on a mobile device, e.g. if the media breakpoint is less than 768px?

Many thanks,

Ali

Comments

AliMartin created an issue.

arne.olafson’s picture

You can do it with javascript, here's an example using Drupal.behaviors:

(function ($) {
  Drupal.behaviors.removeNotFrontVideo = {
    attach: function (context, settings) {
		$('.not-front video#bg_video').remove(); 
    }
  };
})(jQuery);

This code will run before the html video element gets rendered, so the not-front pages won't download the video

Vincent_Jo’s picture

Hi,
#2, where to put this code?

regards
Vincent

arne.olafson’s picture

I generally create a js folder in my theme folder, and create a themename.behaviors.js file
A common method to call the file is to add a line to your themename.info file as follows:
scripts[] = js/themename.behaviors.js
Note that additional functions can be put in this wrapper as follows:

(function ($) {
  Drupal.behaviors.firstFunction = {
    attach: function (context, settings) {
		$('element').action(); 
    }
  };
  Drupal.behaviors.secondFunction = {
    attach: function (context, settings) {
		$('element').action(); 
    }
  };
  // And so on...
})(jQuery);
Vincent_Jo’s picture

Great, thanks, that works!

regards
Vincent

ericfranzee’s picture

video plays on all mobile browser in a container and as sure make it impossible to view main site
would be nice if all mobile relies on image background rather the video background
please any way to fix this issue and how