Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide script from Mobile browsers #32

Open
GoogleCodeExporter opened this issue Mar 2, 2016 · 4 comments
Open

Hide script from Mobile browsers #32

GoogleCodeExporter opened this issue Mar 2, 2016 · 4 comments

Comments

@GoogleCodeExporter
Copy link

The script works fantastically well as intended on a non-mobile devise. But on 
an andoid browser, tablet in my case, the video does not play because of flash 
not being an availble plug-in and even with the flash plug-in installed. The 
page goes out of wack as any mobile browser I've tried does not reder it well.

So my question is:
Can someone come up with some code that will hide the script if a mobile 
browser is detected.

Even using a media query does not work because most tablet browsers can handle 
the desktop version of a site. 

If using a Agent sniffer to detect mobile and redirect, that means you will 
have to recreate the site for a mobile version - which Im trying to avoid.

Using css, I'd like to hide the script if the max-width is 768px lets say.
Im not the best at css so I dont know if this is possible.
Can't hide the wrapper because then the whole site disappears.
Just need to strip the code if mobile is detected or if screen size falls below 
768px... Any ideas anyone?
thanks in advance.
Love the script.

Original issue reported on code.google.com by emarketa...@gmail.com on 6 Jan 2013 at 6:45

@GoogleCodeExporter
Copy link
Author

I would go something like that:

if (window.matchMedia("(min-width: 769px)").matches) {
       $("#wrapper").tubular({
           videoId: 'idOfYourVideo',
           mute: false,
           repeat: true
       }); // where idOfYourVideo is the YouTube ID.
   }

It's pretty simple: run tubular.js only when viewport is bigger than 769px

Hope it helps.

Original comment by nicola.z...@gmail.com on 17 Apr 2013 at 8:20

@GoogleCodeExporter
Copy link
Author

Hi Nicola,

I could not get this to work. Im not sure where you meant to place this code.
Can you or someone give me more direction here.

So i run this as a script on the particular page?
thanks

Original comment by emarketa...@gmail.com on 1 Jul 2013 at 7:54

@GoogleCodeExporter
Copy link
Author

This sounds similar to the issue I just posted about users needing to interact 
with a video before the api will work. Might try the patch in 
https://code.google.com/p/jquery-tubular/issues/detail?id=44 and see if it 
helps.

Original comment by b...@stupil.com on 23 Aug 2013 at 4:51

@GoogleCodeExporter
Copy link
Author

Excellent, works fine! Thanks Nicola!

Original comment by e...@guigo.net on 21 Oct 2014 at 1:08

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant