随时日期选择器关闭日期选择

发布于 2024-12-01 18:01:51 字数 460 浏览 0 评论 0原文

当用户用鼠标单击日期时,“随时”日期选择器不会关闭,只有当用户按 Enter 键时才会关闭。我怎样才能使它通过单击鼠标来关闭?我在 everytime.js 中找到了这段代码:

if ( this.oDiv && this.oDiv.is(':visible') )
                this.dismissODiv(event);
              else if ( this.yDiv && this.yDiv.is(':visible') )
                this.dismissYDiv(event);
              else if ( this.pop )
                this.dismiss(event);

我相信这是用户按 Enter 时执行的代码。我想我只需要把这段代码粘贴到鼠标点击功能中,但我找不到它。

The Any Time date picker doesn't close when the user clicks a date with the mouse, only when they hit enter. How can I make it so it closes with a mouse click? I found this code in anytime.js:

if ( this.oDiv && this.oDiv.is(':visible') )
                this.dismissODiv(event);
              else if ( this.yDiv && this.yDiv.is(':visible') )
                this.dismissYDiv(event);
              else if ( this.pop )
                this.dismiss(event);

This I believe is the code that executes when the user hits enter. I think I just need to paste this code in the mouse click function, but I can't find it.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

埖埖迣鎅 2024-12-08 18:01:51

我找到了这个函数(但是我还没有测试过),它位于 1579~1592 行之间。

为了找到处理程序,我首先搜索了 jQuery(AnyTime 日期选择器使用的 JS 库)的 .click 函数,该函数经常用于处理点击事件。

我发现的一个是在 btn() 函数中,注释说这个函数是用来制作按钮的。因为据记载 .btn() 由 AnyTime.picker() 调用...“处理程序”绑定到

的单击事件。 ...,我接下来要做的就是在 Anytime.picker() 函数中找到一个代码,它可以制作日期按钮。

然后我搜索 Anytime.picker = function( 来查找 Anytime.picker() 函数的定义,我发现 askDoM 变量 (在第 1452 行中)用于确定是否“询问”月份中的哪一天。

由此,我轻松找到了从第 1557 行开始的制作日期按钮的代码,然后我发现使用处理程序调用 btn 函数的代码。

I found the function (I haven't tested yet, however), and it's between line 1579~1592.

To find the handler, I first searched jQuery(a JS library which AnyTime date picker is using)'s .click function, which is frequently used for handling click events.

One I found was in the btn() function, which comment says that this function is for making buttons. Since it is written that .btn() is called by AnyTime.picker() ... The "handler" is bound to click events for the <div> ..., next thing I did is to find a code in Anytime.picker() function which makes buttons of days.

Then I searched for Anytime.picker = function( to find the definition of Anytime.picker() function, and I found that askDoM variable (in line 1452) is used to determine whether the day of month is 'asked'.

From that, I easily found the code making buttons of days which starts from line 1557, and then I found the code calling btn function with the handler.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文