0
I’m having trouble with the following code:
//Desktop = D
var posicaoMenuD = $('#desktop-menu').position().top();
$(document).scroll(function(){//Alscutador de scroll da página
var posicaoScrollD = $(document).scrollTop(); //Obtém o scroll atual (posição)
if (posicaoMenuD < posicaoScrollD){
$("#desktop-menu").css('top':$("#desktop-top-menu").height().val());
}
});
I’m trying to pass variables on the property .css()
of jquery
, however, unsuccessfully, I tried to declare the variable before too, but likewise it did not work, in the console
, the message:
scrolls-home.js:6 Uncaught SyntaxError: missing ) after argument list
I would like to know how I can solve such a problem, and if possible an explanation accompanied by the code, because I want to understand what is going on.
try
$("#desktop-menu").css('top', $("#desktop-top-menu").height());
– Leonardo Rodrigues
here gave the same mistake :(
– Murilo Melo
Okay, so try to get one
console.log($("#desktop-top-menu").height().val()));
and after that, try to define a predefined css, like this:$("#desktop-menu").css('top', '30px');
. Don’t forget to add the measurement structure to the end of the variable as well– Leonardo Rodrigues