doulu8341 2011-05-02 14:26
浏览 27

AJAX .load()进入<div>移动屏幕 - 让我抓狂!

I'm hoping that someone would be kind enough to offer a little help with this one.

I have a <DIV> at the bottom of my client's pages which contains an order form. When the form is submitted it sends the data to a php script which processes and returns a layout replacing the form in the <DIV>. This all works except for one annoying thing:

The window moves up a little so that the resulting layout is half off the bottom of the screen. I'd rather it didn't, and just load the layout into the <DIV> without any screen movement.

Can anyone offer a little help to prevent the window moving up? Thanks!

  • 写回答

2条回答 默认 最新

  • dongtun1683 2011-05-02 14:45
    关注

    It sounds like you are clearing the html in the div before adding the new 'layout'. I can't be sure without seeing your code of course.

    However, a fix for this is to sneakily scroll the window for the user since it is at the bottom of the page anyway. Add this to the end of the AJAX.load callback:

     $('html').animate({scrollTop: $elem.height()}, 100);
    
    评论

报告相同问题?

悬赏问题

  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)