开发者

How to avoid blinking in jQuery

开发者 https://www.devze.com 2023-02-19 13:32 出处:网络
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 wi

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 开发者_C百科problem because of the scroll bar or what?


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);
});


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;


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消