mb.YTPlayer for background videos
A way to de-activate for certain resolutions? (2 posts)

  1. choazie
    Posted 2 years ago #

    Hey Matteo! Last question, I promise! Your lovely plugin is a very important element to my site so I'm keen to get it working perfectly.

    I have my video background set to autoplay and have a fallback div for resolutions under 1050px (mobile devices). The issue is that <1050px desktop browsers are seeing the fallback div and hearing the audio from mb.YTPlayer at the same time. I only want these people to see the fallback div and not see mb.YTPlayer at all.

    Can I disable the player for certain resolutions with a media query or would I instead need to input something into the .js file?

    Any help on this would be very much appreciated! Thanks.

    Page: http://www.ilovestvincent.com


  2. pupunzi
    Plugin Author

    Posted 2 years ago #

    You can only do that via javascript creating your own function to detect screen size on resizing and removing the YTPlayer container if the resolution is lower than 1050. You can't do it via CSS.

    Should be something like:

      var video = $("#bgndVideo1");
      if($(window).width()<1050 && ! video.attr("paused")){
        video.attr("paused", true)
        video.attr("paused", false)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic