我的Web App中有一个DatePicker jQuery日历。 此时更改为上一个月或下个月的箭头是“透明的”。 但是,我意识到它是有效的,因为如果我点击“箭头”月份的变化。
我在Developper Tool上尝试了以下代码,它可以工作:
$('.ui-datepicker-next span').addClass('ui-btn ui-corner-all ui-icon-arrow-r ui-btn-icon-notext ui-alt-icon ui-nodisc-icon'); $('.ui-datepicker-prev span').addClass('ui-btn ui-corner-all ui-icon-arrow-l ui-btn-icon-notext ui-alt-icon ui-nodisc-icon');如何在mi代码中添加此代码示例? 我试图将它包含在“beforeShow”方法中,但它不起作用。
有人想知道图标吗?
谢谢!!
I have a DatePicker jQuery calendar in my Web App. The arrows which change to the previous or the next month are 'transparent' at the moment. However, I realised that it works beacause if I click on the "arrow" the month changes.
I've tried the following code on the Developper Tool and it works:
$('.ui-datepicker-next span').addClass('ui-btn ui-corner-all ui-icon-arrow-r ui-btn-icon-notext ui-alt-icon ui-nodisc-icon'); $('.ui-datepicker-prev span').addClass('ui-btn ui-corner-all ui-icon-arrow-l ui-btn-icon-notext ui-alt-icon ui-nodisc-icon');How can I add this code sample in mi code? I've tried to include it on the "beforeShow" method but it doesn't work.
Have someone any idea to show the icons?
Thanks!!
最满意答案
如果你的图标没有正确显示,可能是因为你遗漏了像css样式这样的东西。
无论如何,回答你的问题,如果你想要做的是在beforeShow打开后添加这些clases,你可以在你的beforeShow方法中添加一个小延迟,如下所示:
setTimeout(function() { $('.ui-datepicker-next span').addClass('ui-btn ui-corner-all ui-icon-arrow-r ui-btn-icon-notext ui-alt-icon ui-nodisc-icon'); $('.ui-datepicker-prev span').addClass('ui-btn ui-corner-all ui-icon-arrow-l ui-btn-icon-notext ui-alt-icon ui-nodisc-icon'); }, 500);这将在500ms之后添加类,这足以让jquery生成datepicker
If your icons are not being displayed properly it's probably because you are missing something like the css styles.
Anyway, answering to your question, if what you want to do is add those clases after the datepicker has opened, you can add a small delay in your beforeShow method like the following:
setTimeout(function() { $('.ui-datepicker-next span').addClass('ui-btn ui-corner-all ui-icon-arrow-r ui-btn-icon-notext ui-alt-icon ui-nodisc-icon'); $('.ui-datepicker-prev span').addClass('ui-btn ui-corner-all ui-icon-arrow-l ui-btn-icon-notext ui-alt-icon ui-nodisc-icon'); }, 500);That will add the classes after 500ms which will be enough for jquery to generate the datepicker
更多推荐
发布评论