如何避免在jQuery中闪烁
I developed a simple jquery ajax php application. I done a pagination. In that the pages could load by using AJAX. When ever user clicks on the page number in the pagination. I can able to see some window blink. How i can avoid this problem? The problem because of the scroll bar or what?
我开发了一个简单的jquery ajax php应用程序。 我做了一个分页。 因为页面可以使用AJAX加载。 当用户点击分页中的页码时。 我能看到一些窗口闪烁。 我怎么能避免这个问题? 因为滚动条还是什么问题? p> div>
I'm not sure to understand your problem but if the problem is caused by the scrollbar you should look at the overflow css property: Here
Set this property to scroll:
overflow:scroll;
Another problem might be that if you are fade-ing the elements to hide the old and show the new content, you might need to get them nested, like this:
$("#content").fadeOut(400, function(){
// this gets executed when fadeOut has completed
$("#content").fadeIn(400);
});
Yet another problem, and this might actually be my best bet, is that when you erase the old content, the site height drops to let's say 200px, a very low number, and your browser scrollbar gets erased -> the site moves right about 5px. Then, when the new content is loaded, the site is long in height again and the scrollbar is visible again -> the site moves back left. All this happens extremely fast and it might look like a blink that you described. Is this your problem? If yes, I'll give you the solution.