# Fix Pagination Box while scrolling

**URL:** <https://forums.knack.com/t/fix-pagination-box-while-scrolling/7639>\
**Category:** API & Custom Code\
**Created:** [May 13, 2016, 12:14am UTC](https://forums.knack.com/t/fix-pagination-box-while-scrolling/7639 "2016-05-13T00:14:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![EricBeekma26401](https://avatars.discourse-cdn.com/v4/letter/e/eb8c5e/32.png) [@EricBeekma26401](https://forums.knack.com/u/EricBeekma26401)\
**Post date:** [May 13, 2016, 12:14am UTC](https://forums.knack.com/t/fix-pagination-box-while-scrolling/7639/1 "2016-05-13T00:14:31Z")

</div>

Inspired by Brad Stevens' old post which popped up recently,

[Fix Tab menu when scrolling](http://helpdesk.knackhq.com/support/discussions/topics/5000011723)

I've been trying to do the same thing with the Pagination box. I'd like it to stay fixed to the top of the screen while scrolling. I've tried a few things but with indifferent success (I'm teaching myself and don't really understand what I'm doing).

Changing the position in CSS was a fairly simple solution:

div.kn-pagination {

position: fixed;

right: 30px;

top: 20px;

}

The box just stays put in the top right corner. It works, it's just not very neat.

Here's my attempt at using Javascript:

$(document).scroll(function() {

if ($(window).scrollTop() \> 310){

$('.kn-pagination').css({'position':'fixed', 'top':'0px', 'z-index':'9999'})

}else{$('.kn-pagination').css({'position': 'static', 'width': '100%'})

}})

With this I managed to make it scroll at the top of the page! A small victory, but I seem to be missing something. As soon as I start to scroll the Pagination box moves over to the left of the table and then is stuck to the left of the screen. I can't seem to move it back to the right where it belongs even when I modify the CSS in the script.

Any suggestions?
