随时日期选择器关闭日期选择
当用户用鼠标单击日期时,“随时”日期选择器不会关闭,只有当用户按 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我找到了这个函数(但是我还没有测试过),它位于
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 inAnytime.picker()
function which makes buttons of days.Then I searched for
Anytime.picker = function(
to find the definition ofAnytime.picker()
function, and I found thataskDoM
variable (in line1452
) 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 callingbtn
function with the handler.