duan0802 2014-08-04 11:11
浏览 33
已采纳

Datepicker位置错误

Image I am developing an php aplication and I used datepicker javascript. The problem with this is that if I scroll down it does not appear in the right position. It gets really bad if the page gets too long, the date picker is not even visible.

I am using IExplorer, it might be outdated. It is not a solution to update the browser, cause this needs to run on 200+ PCs

<script type="text/javascript" language="javascript">
$(function(){ $("#udate").datepicker({ dateFormat:'yy-mm-dd'}); });
</script>
<input type="text" id="udate" name="udate">

Code as requested by comment

<style type="text/css">
html {
overflow-y: scroll;
}
body {
    size:8;
}
</style>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  • 写回答

5条回答 默认 最新

  • dovt85093 2014-08-04 11:39
    关注

    Try this work around to adjust position of datepicker after it opens (please adjust position as per your requirement)

    <script type="text/javascript" language="javascript">
      $(function(){ 
            $("#udate").datepicker({ dateFormat:'yy-mm-dd'}); 
            // bind click event and adjust datepicker position.
            $(".hasDatepicker").click(function(e){
                $("#ui-datepicker-div").css({'top':e.pageY+20,'left':e.pageX-250});
            });
      });
    </script>
    
    <input type="text" id="udate" name="udate">
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(4条)

报告相同问题?

悬赏问题

  • ¥50 求解vmware的网络模式问题
  • ¥24 EFS加密后,在同一台电脑解密出错,证书界面找不到对应指纹的证书,未备份证书,求在原电脑解密的方法,可行即采纳
  • ¥15 springboot 3.0 实现Security 6.x版本集成
  • ¥15 PHP-8.1 镜像无法用dockerfile里的CMD命令启动 只能进入容器启动,如何解决?(操作系统-ubuntu)
  • ¥30 请帮我解决一下下面六个代码
  • ¥15 关于资源监视工具的e-care有知道的嘛
  • ¥35 MIMO天线稀疏阵列排布问题
  • ¥60 用visual studio编写程序,利用间接平差求解水准网
  • ¥15 Llama如何调用shell或者Python
  • ¥20 谁能帮我挨个解读这个php语言编的代码什么意思?