$(function () {
    var offset = $("#box").offset();
    var topPadding = 15;
    $(window).scroll(function () {
        if (offset != null) {
          if ($(window).scrollTop() > offset.top) {
            $("#box").stop().animate({
                marginTop: $(window).scrollTop() - offset.top + topPadding
            });
        } else {
            $("#box").stop().animate({
                marginTop: 0
            });
        };
        }
     
    });
});

$(document).ready(function(){
	$(".btn-slide").click(function(){
	  $("#panel").animate({
	  "width": "toggle"
	}, { duration: "slow" });
	});
});
