pupunzi / jquery.mb.YTPlayer

use a custom yutube player for a video as background on jQuery framework
https://pupunzi.com/mb.components/mb.YTPlayer/demo/demo.html
1.3k stars 431 forks source link

Hide player only on mobiles and not on tablets #392

Closed nkki closed 5 years ago

nkki commented 5 years ago

Hello, is it possible to only hide the player on mobiles and not on tablets using the useOnMobile function? thank you

pupunzi commented 5 years ago

Hi, the "useOnMobile" option doesn't distinguish between Tablets and smartphones. If you want that distinction you can make your own function that returns it is a tablet or not to set the useOnMobile option:

function isTablet() { 

        // The jQuery.browser.js in bundle with the mb.YTPlayer.js 
        // set the jQuery.isTablet variable based on the mobile verification
        // and on the screen size.

        // Use your own verification if more relayable.

        return jQuery.isTablet;
}

jQuery("#bgndVideo").YTPlayer({ useOnMobile: isTablet() });
nkki commented 5 years ago

It works! Thank you so much. I'm inlove with this plugin. Hope you create more like this, in the future. God Bless!

pupunzi commented 5 years ago

Great! :-)