javascript 完整日历 - 将可点击的图标与事件相关联?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11537525/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
full calendar - associate clickable icons with events?
提问by stephen
I want to append 4 icons each event on the calendar. Each icon should calls different function on click event. To be honest, I am not too good in CSS. I have tried the below code but the click event for these icon is not invoked. Instead events event is invoked. Is there anyway to append 4 icons with clickable event? Thank you in advance
我想在日历上为每个事件附加 4 个图标。每个图标应该在点击事件上调用不同的函数。老实说,我在 CSS 方面不太擅长。我已经尝试了下面的代码,但没有调用这些图标的点击事件。而是调用 events 事件。无论如何要附加 4 个带有可点击事件的图标吗?先感谢您
eventRender: function(event,element,calEvent) {
element.find(".fc-event-title").after($("<span class=\"fc-event-icons\"></span>").html("<img src=\"/images/pass.png\" onclick=\"javascript:icons("+this.id+");\" /><img src=\"/images/pass.png\" onclick=\"javascript:icons("+this.id+");\" /><img src=\"/images/pass.png\" onclick=\"javascript:icons("+this.id+");\" /><img src=\"/images/pass.png\" onclick=\"javascript:icons("+this.id+");\" />"));
}
回答by ganeshk
I think you need to use the .on()
function to register an event handler to your icons.
我认为您需要使用该.on()
函数将事件处理程序注册到您的图标。
Check this fiddle: http://jsfiddle.net/100thGear/rpc23/
检查这个小提琴:http: //jsfiddle.net/100thGear/rpc23/
The click events get triggered and are handled appropriately with the .on()
handler. Let me know if this helps!
单击事件被触发并由处理.on()
程序适当处理。如果这有帮助,请告诉我!