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

  • Home
  • SEARCH
  • 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 6715033
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T08:33:56+00:00 2026-05-26T08:33:56+00:00

I wonder if anyone can work this HTML, CSS, Javascript puzzle out? I’m using

  • 0

I wonder if anyone can work this HTML, CSS, Javascript puzzle out?

I’m using an @media viewport CSS declaration to detect mobile screen sizes, which minifies my website for mobile visitors, purely using CSS which is nice as I only have 1 website to update, not 2. So far so good… 🙂

However, in my HTML there’s a line of code referencing a Javascrit file that makes this really nice ‘soft scrolling’ effect on the main navigational ul li a links (eg ).

This all works fine on the normal version of the site, but for some unknown reason it stops the navigation working altogether on the minified version of the site. If I delete this link to the js/softscroll.js file, then the links on the minified site work fine & I’m OK about loosing this effect on the mini version, but then… the main sites navigation stops! :< I have to have this effect for the main site btw.

So, my question is…

…Is there a way to make some kind of conditional statement, in either HTML or JavaScript (JS I imagine!), that will tell browser to only use that JavaScript (js/softscroll.js) …IF … the visitor is ONLY viewing the normal site, and… obviously ignore the js/softscroll.js file IF the mobile version of the site is being accessed?

Whoaw! I hope you understand what the hell I’m going on about!? Ha! Your probably wondering what I’m trying to achieve here, or why I’m so into this javascript effect? Long story, but let’s just say I’m making one of those crazy side scrolling websites and it’s vital! :0)

So yeh? any help welcome! Thanks for your time!

  • 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-26T08:33:57+00:00Added an answer on May 26, 2026 at 8:33 am

    You can conditionally load a script with jQuery:

    http://api.jquery.com/jQuery.getScript/

    if(mainsite) $.getScript('js/softscroll.js');
    

    UPDATE

    First, when you need Javascript, you REALLY need jQuery. Best to download it and put it on your site – http://jquery.org

    But here’s a way that might work now:

    in the head section of your app:

    <script type="text/javascript" src="http://code.jquery.com/jquery-1.6.4.min.js"></script>
    

    Next, you need a way to know if your site is being accessed by a mobile device or not:

    <script>
        var platform = navigator.platform.toLowerCase();
        var mobile = platform.match(/(iphone|ipod|ipad|android)/);
    

    Then, you need to conditionally load your special script:

        if(!mobile) $.getScript('js/softscroll.js');
    </script>
    

    Those six lines of code, added to the head section of your site, will probably do for now:

    <script type="text/javascript" src="http://code.jquery.com/jquery-1.6.4.min.js"></script>
    <script>
        var platform = navigator.platform.toLowerCase();
        var mobile = platform.match(/(iphone|ipod|ipad|android)/);
        if(!mobile) $.getScript('js/softscroll.js');
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wonder if anyone can help - I have this error showing recently when
I wonder if anyone can help me filter this data in some way? Here
I wonder if anyone can help. An HTML div in a page of mine
Wonder if anyone can help me understand how to sum up the column of
I wonder if anyone can provide me with the regular expressions needed to parse
I wonder if anyone can help improve my understanding of JOINs in SQL. [If
I wonder if anyone can think of a good technique to enable any arbitrary
I wonder if anyone can help me to understand where I could be going
I have a bit of a pickle here and wonder if anyone can give
I wonder if anyone can help? After Google announced that it will take note

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.