Try using this instead:
<script src="http://ift.tt/1led9Oq; type="text/javascript"></script>
<style>
.ms-viewheadertr{background-color:white;}
</style>
<script>
/*wrap the table in a div, set its height, give it scrollbars, and move it down*/
$(".ms-listviewtable").wrap("<DIV style='OVERFLOW: auto; HEIGHT: 400px; padding-top:38px;'></DIV>");
/* get all the column headings and tell them to stay their current size */
headers = document.querySelectorAll("tr.ms-viewheadertr th");
for(var i = 0; i < headers.length; i++){
headers[i].style.width = ""+headers[i].clientWidth + "px";
}
/* get the header row and tell it to stay in position above the table */
var headerRow = document.querySelector(".ms-viewheadertr");
headerRow.style.position = "absolute";
headerRow.style.top = ""+(headerRow.offsetTop-headerRow.clientHeight)+"px";
</script>
And make sure this content editor web part is below the list view web part, to ensure it doesn't run before the list has loaded.
It may not work so nicely if individual item checkboxes are enabled on the list view.
No comments:
Post a Comment