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 8520317
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T06:30:02+00:00 2026-06-11T06:30:02+00:00

I have a jQuery script for a Back to Top button as listed below:

  • 0

I have a jQuery script for a “Back to Top” button as listed below:

<script type="text/javascript">
$(document).ready(function(){

// hide #back-top first
$("#TopButton").hide();

// fade in #back-top
$(function () {
    $(window).scroll(function () {
        if ($(this).scrollTop() > 100) {
            $('#TopButton').fadeIn();
        } else {
            $('#TopButton').fadeOut();
        }
    });

    // scroll body to 0px on click
    $('#TopButton, #logo').click(function () {
        $('body,html').animate({
            scrollTop: 0
        }, 800);
        return false;
    });
});

});
</script>

I have two stylesheets one for desktop and one for mobile. I am trying to hide the back to top button when the mobile stylesheet is used as so:

#TopButton {
display: none;
}

but it still appears. Is there anyway around this without having mess with the HTML?

Thanks in advance.

  • 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-06-11T06:30:04+00:00Added an answer on June 11, 2026 at 6:30 am

    Your current method is having trouble because your javascript code .fadeIn() will override your display: none;

    You need to set a CSS value that won’t be affected by the jquery code. I’m assuming your #TopButton is absolutely positioned? If it is, try setting a property such as

    left: -9999px;
    

    That will keep it off the page, and it won’t be affected at all when jQuery tries to fade it in.

    Hopefully that helps you out

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

Sidebar

Related Questions

I have the following jQuery <script type=text/javascript> jQuery(function(){ jQuery('.link1').click(function(){ jQuery('.hide-div').hide(); jQuery('.toggle1').show(); jQuery('#arrow').css({top: '0px'}); });
right now i have this <script type='text/javascript'> $(#beau).click(function(){ $(#beau).animate({margin-Top: 738px}, fast); }); </script> and
I have the following jQuery functions: <script type=text/javascript> $(function() { // setTimeout() function will
I have a jQuery script: $.ajax({ url: /scripts/secure/development/ajax.asp, type: POST, dataType: text, data: cmd=addresses,
I have the following jquery script: $(function(){ $('#top-menu').on('click', 'a.change-menu', function(e){ e.preventDefault() $(#menu-change-div).load($(this).attr(href)); }); });
I have this jQuery script that works fine: $(select).change(function () { var finalPrice =
I have this jquery script which suppose to hide/show div element base on the
I have this jQuery script var dataString = class_id=+class_id; $.ajax({ type: POST, url: page.php,
On my website www.staygold-design.com I have a fancybox jquery script on a button under
My Templates: <script id=tmp_servicebuttons class=template type=text/x-jquery-tmpl> <li><a class=notification href=${id}><img src=${imgsrc}/></a></li> </script> <script id=tmp_navigation class=template

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.