0

UPDATE : I Suppose a better way to describe it is i want the link to load a different page depending on screen size so if on desktop it loads page1.html when clicked and if on mobile it loads page2.html when clicked.

So im at a loss with this one, I have a nav bar on my website and on that is the word "forum" when you click forum it loads a lytebox and the forum loads within that, now that is great for laptops or desktops, but doesn't load so well with mobiles, so what I wanted to know... is it possible to add any script that says if the user is using a mobile phone or a screen res that is small, that it opens the link as a new page rather than using the lytebox.

I'll add my nav code below so you can see the current set up.

<div class="nav-collapse collapse pull-right">
    <ul class="nav" id="top-navigation">
        <li class="active"><a href="index.html">home</a>    </li>
        <li><a href="#" id="showRight">TS Viewer</a></li>
        <li><a href="#price">Servers</a></li>
        <li><a href="squad.html">Members</a></li>
        <li><a href="http://www.myforum.com/example" rel="lyteframe" title="IRU" rev="width:100%; height:100%; scrolling: no;">Forum</a></li>
        <li><a href="#donate">Donate</a></li>
        <li><a href="#contact">Contact</a></li>   
    </ul>
</div>
ashjones86
  • 128
  • 1
  • 1
  • 10
  • 4
    you can make two links with different classes and show/hide them in a css rule inside a media query – dandavis Jun 17 '15 at 08:06
  • possible duplicate of [Get the size of the screen, current web page and browser window](http://stackoverflow.com/questions/3437786/get-the-size-of-the-screen-current-web-page-and-browser-window) – blgt Jun 17 '15 at 08:14
  • No its not, so please dont vote down.... – ashjones86 Jun 17 '15 at 08:16

3 Answers3

0
$("#nav a").click(function(){
if( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) || $(window).width()<=768){
        //mobile
    }
    else{
        //pc
    }
});
mickrus
  • 13
  • 5