Hide Jquery Ui Datepicker on Scroll

Posted By : Gaurav Arora | 30-Sep-2016

Hide Jquery Ui Datepicker on Scroll

In this blog I’m gonna show how to hide ui datepicker on scroll, as it stays visible when we scroll the page. Mainly it creates issue when we are using datepicker in the modal and modal’s height is bit more than the page in short the modal scrolls. While scrolling the modal we can notice that the datepicker is still visible and overlaps over other content. So, we can come over this issue using window.scroll.

The basic structure of our modal will look like this.



And this is the our basic css and that’s for defined height modal.

.modal-body {
    min-height: 500px;
    max-height: 500px;
    overflow: auto;
}
 

As we can see that there is a scrollbar over modal-body. So, here we will use window.scroll function over modal’s body.

 $(".modal-body").scroll(function(){
	$("#ui-datepicker-div").hide();
});

In this way we can hide our datepicker on scroll.

THANKS

About Author

Author Image
Gaurav Arora

Gaurav is an experienced UI developer with experience and capabilities to build compelling UI's for Web and Mobile Applications.

Request for Proposal

Name is required

Comment is required

Sending message..