Home  >  Article  >  Web Front-end  >  Introduction to some settings of jquery easyui scroll bar_jquery

Introduction to some settings of jquery easyui scroll bar_jquery

WBOY
WBOYOriginal
2016-05-16 17:22:471204browse

When using the dialog plug-in, the screen is centered by default. However, when the scroll bar appears on the page, the dialog does not scroll down with the scroll bar. At this time, the user needs to slide the scroll bar to position the dialog. This is not humane. Before coming up with the solution, let’s popularize several jquery positioning methods

Copy the code The code is as follows:

//Get the height of the browser display area
$(window).height();
//Get the width of the browser display area
$(window).width();

//Get the document height of the page
$(document.body).height();
//Get the document width of the page
$(document.body).width();

//Get the vertical height of the scroll bar to the top
$(document).scrollTop();
//Get the vertical width of the scroll bar to the left
$(document).scrollLeft( ; Call the panel's move function to move the dialog


Copy code The code is as follows: $('# dlg').dialog('open');
$("#dlg").panel("move",{top:$(document).scrollTop() ($(window).height()-250 ) * 0.5});


where $(window).height()-250, where 250px is the width of the dialog.
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn