I would like to use variable in css('width', 'topPosition+"px"')method but whether I try 'px' or other ways it is not working.
$("document").ready(function () {
$(window).scroll(function () {
var topPosition = $('#cialo').scrollTop();
console.log(topPosition);
if (topPosition != 0) {
$("logoBg").css('margin-top', 'topPosition+"px"')
};
});
How to do it?