【发布时间】:2012-08-01 20:32:14
【问题描述】:
我有一个涉及几个不同框架/库的问题,尽管主要是 Twitter Bootstrap(js) 和 Rails。
我的应用中有一个链接,响应一些 js:
$(function() {
var $modal = $('<%= escape_javascript( render 'front_end/bookings/modal', :product => @product, :customer => @customer, :booking => @booking ) %>'),
$calendar = $modal.find('#calendar'),
currentProduct = <%= raw(@product.to_json) %>;,
initBookingCalendar;
$('body').append($modal);
$modal.modal('show');
/* Booking Calendar */
initBookingCalendar = function(el, productId) {
el.fullCalendar()
...
};
$($modal).on('shown', function() {
if($calendar.is(':empty')) {
initBookingCalendar($calendar, <%= @product.id %>);
}
});
});
问题是 'shown' 事件由于某种原因在 IE9 中没有触发!?我在这里重现了这个问题:http://jsfiddle.net/tvkS6/ 并通过这样做:http://jsfiddle.net/tvkS6/9/ 让它工作。问题是我不知道如何在我的代码中实现解决方案,因为我并不真正了解问题所在。
我必须等待 initBookingCalendar 直到模式完全显示的原因是 jQuery FullCalendar 插件要求元素在呈现日历之前可见。
感谢任何提示!
【问题讨论】:
标签: jquery ruby-on-rails twitter-bootstrap fullcalendar jquery-events