Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript how to stop specific jquery functions on mobile devices

  • This topic is empty.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #34795
    yojames
    Member

    Hi all

    I’m working on a ‘responsive’ wordpress site at the moment using some jquery here and there.

    But I have found that there are a couple of functions which I do not want to run on iphone & ipad as its causing some headaches with layout

    does anyone know a simple way to prevent scripts running on iphone/ipad etc?

    thanks

    #89120
    TheDoc
    Member

    I’m sure you should be able to detect if the user is using mobile and then not load things. I don’t know what that code is, but there must be something already written out there!

    #89153
    yojames
    Member

    Thanks I found this which seems to do the trick.

    https://github.com/paulirish/matchMedia.js/

    I was sure there would be simple solution somewhere

    #89164
    Fourize
    Member

    I had exactly the same problem today, i ended up using this in my jquery sheet, not sure how reliable it is but it may help…

    if (screen.width <= 540) {
    *code here }
    if (screen.width >= 541) {
    *code here }

    #89171
    yojames
    Member

    thanks I’ll give that it go

Viewing 5 posts - 1 through 5 (of 5 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.