Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* $.ua: iPhone, iPad, iPod detection */
- /**
- * $.ua
- */
- $.ua = (function(){
- var o = {};
- var ua = navigator.userAgent;
- $.each(['iPhone', 'iPod', 'iPad'], function(i, current){
- o[current] = Boolean(ua.match(new RegExp(current, 'i')));
- o.appleDevice = o.appleDevice || o[current];
- });
- return o;
- })();
- /**
- * test
- */
- $(function(){
- /*
- <ul id="test"></ul>
- prepare this element and do...
- */
- $('#test').append(
- '<li>iPhone? ' + $.ua.iPhone + '</li>',
- '<li>iPod? ' + $.ua.iPod + '</li>',
- '<li>iPad? ' + $.ua.iPad + '</li>',
- '<li>appleDevice? ' + $.ua.appleDevice + '</li>'
- );
- });
Add Comment
Please, Sign In to add comment