Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6836739
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:23:31+00:00 2026-05-26T23:23:31+00:00

I got some javascript for sliding menus, but I need some values to be

  • 0

I got some javascript for sliding menus, but I need some values to be different for different size screens.

This is my script for reference:

    $('.show-menu').on('click', function () {
        if ($(".menu-button").html() == 'CLOSE') {
            $("#slideover").animate({
                right: "0"
                }, 300);
            $(".black-cover").fadeOut(300);
            $(".menu-button").html('MENU');
                } else {
            $("#slideover").animate({
                right: "512px"
                }, 300);
            $(".black-cover").fadeIn(300);
            $(".menu-button").html('CLOSE');
            }
        });

My question is that is it possible to load in .js files scripts similar to the link query below?

<link rel="stylesheet"
      media="only screen and (orientation:landscape) and (orientation:portrait)" href="ipad.css">

<link rel="stylesheet"
      media="only screen and (-webkit-min-device-pixel-ratio: 1.5) and (-o-min-device-pixel-ratio: 3/2) and (min-device-pixel-ratio: 1.5)" href="iphone.css">

If you need me elaborate the question let me know or if you can think of another solution then awesome, thanks in advance.


UPDATE, Thanks for the 3 answers, I can see all of them working a beaut.

I’m going to try them all and repost the one that works the fastest and is lightest 🙂

Again, thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T23:23:32+00:00Added an answer on May 26, 2026 at 11:23 pm

    Use window.matchMedia(). Here’s a polyfill: https://github.com/paulirish/matchMedia.js

    If you want to load different script files based on which media query currently matches, you could combine the above with a script loader like LAB.js or yepnope.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got some XML (valid XHTML) that looks like this: <html> <head> <script type=text/javascript>
I have got some javascript code and I'd like to convert this to C#.
I got some idea from a C# related thread , but I need it
I've got this bit of jQuery with some javascript and RegEx mixed in: $(function()
I've got code like this in an .aspx file: <script type=text/javascript language=javascript> function init()
I've got some JavaScript in an ASP.NET page that looks like this: var list
Hello there i got some code here; <script type=text/javascript> $(function(){ var playListURL = 'http://gdata.youtube.com/feeds/api/playlists/8BCDD04DE8F771B2?v=2&alt=json&callback=?';
This may be very convoluted and twisted idea. Got it while learning some JavaScript.
I've got an offline html page on my hdd with some javascript that does
I've got a WebBrowser control on my page. To fire some javascript on a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.