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.