0

I use some JavaScript in my menu when user scroll my webpage. Here is example

All works fine but i want to dissable that effect in media query. Can i disasbel JavaScript in media query ..

@media only screen
 (max-device-width : 360px) {
//dissable JavaScript
}

2 Answers 2

2

Can i disasbel JavaScript in media query ..

No, you can't, neither with CSS Media rule nor with any other programming mechanism. JavaScript activation is a matter of the user preferences in the web-browser.

But you can always use workarounds like this one: how to disable javascript for responsive design

Update:

You can easily test the current CSS media type using jQuery and accordingly to activate your JS code:

var media = $('link[href$="yourStyleFile.css"]').attr('media');
Sign up to request clarification or add additional context in comments.

Comments

0

you cant disable JavaScript, but you can detect the resolution and not write the JavaScript.

this will help you

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.