Tha*_*aka 3 tooltip fullcalendar twitter-bootstrap angularjs angular-ui
我试图在角度UI calendarEvent的鼠标悬停上显示工具提示.我设法执行此操作,如以下线程中所述, 在年视图中为fullcalendar提供工具提示
$scope.eventMouseover = function (calEvent, jsEvent) {
var tooltip = '<div class="tooltipevent">' + calEvent.description + '</div>';
$("body").append(tooltip);
$(this).mouseover(function (e) {
$(this).css('z-index', 10000);
$('.tooltipevent').fadeIn('500');
$('.tooltipevent').fadeTo('10', 1.9);
}).mousemove(function (e) {
$('.tooltipevent').css('top', e.pageY + 10);
$('.tooltipevent').css('left', e.pageX + 20);
});
}
$scope.eventMouseout = function (calEvent, jsEvent) {
$(this).css('z-index', 8);
$('.tooltipevent').remove();
},
Run Code Online (Sandbox Code Playgroud)
显然,这不是最好的方法.使用最新的UI-Bootstrap,我们有一个更好看的工具提示.有没有人成功地将这些工具提示与Angular-UI日历集成在一起?
更新1:如http://arshaw.com/fullcalendar/docs/event_rendering/eventRender/中所述,我尝试重写eventRender并简单地将工具提示属性添加到calendarEvent div.还是行不通.我可以看到,即使mouseover和mouseout事件也没有添加到包含'tooltip'属性的那些calendarEvent div中.
如果您将此功能添加到日历配置,它将工作.
$scope.eventRender = function( event, element, view ) {
$timeout(function(){
$(element).attr('tooltip', event.title);
$compile(element)($scope);
});
};
Run Code Online (Sandbox Code Playgroud)
任何东西都可以放在工具提示属性中.偶{{bindings}}
$ timeout是因为$ scope.$ apply必须被调用.通过使用$ timeout并且没有延迟,可以确保在不抛出"正在进行摘要"错误的情况下调用摘要.
| 归档时间: |
|
| 查看次数: |
7160 次 |
| 最近记录: |