I'm having a code with a javaScript function, and in the "IF" condition I wanted to add another parameter, on the ScrollTop side, because I only want the slideDown to happen if the user of my site is on a computer screen. Take a look at it!
jQuery(document).ready(function($) {
$(function(){
var nav = $('.objeto');
$(window).scroll(function () {
if ($(this).scrollTop() >= 150) {
//nav.fadeIn();
$('#div').css("background","#06f2c9").slideDown(2000);
//$("#div").animate({background-color:"#333"});
} else {
nav.fadeOut();
}
});
});
});
div#div{
background-color:blue;
width:100%;
height:90px;
top:0px;
display:none;
position:fixed;
}
div#conteudo{
background-color:f9f9f9;
width:100%;
height:1000px;
margin:auto;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><body><divid="conteudo">
<div id="div" calss="objeto">Div para aparecer em tela de computador</div>
Role para baixo.
</div>
</body>