Scroll to Top

/*
 * Show/Hide Scroll to Top Button
 */
var to_top = jQuery("#to_top");
jQuery(window).scroll(function () {
    if (jQuery(this).scrollTop() > 350) {
        to_top.fadeIn("slow");
    } else {
        to_top.fadeOut("slow");
    }
});

/*
 * Scroll to Top Button
 */
to_top.click(function () {
    jQuery('html, body').animate({
        scrollTop: 0
    }, 1000);
    return false;
});

Stick a Div

jQuery

var stickyElement = $( "#list-faq-wrap" );
var stickyElementPos = stickyElement.offset();
$( window ).scroll( function () {
	var windowpos = $( window ).scrollTop();
	if ( windowpos >= stickyElementPos.top - 20 ) {
		stickyElement.addClass( "stick" );
	} else {
		stickyElement.removeClass( "stick" );
	}
} );

CSS

.stick {
  position: fixed;
  top: 0;
  z-index: 999;
}