2016-03-21 13 views
0

「x」をイベントの最後に表示しようとしているため、ユーザーがクリックするとそのイベントが表示から削除されます。フルカレンダーイベントタイトルの末尾に「x」を付ける

私がそうするように、次のコードを使用しています。しかし

eventRender: function(event, element) { 
     element.append("<span class='closeon'>X</span>"); 
     element.find(".closeon").click(function() { 
      $('#calendar').fullCalendar('removeEvents',event._id); 
     }); 
    } 

、 'Xは' のようなので、下の行に表示されます。

Event ...

方法イベントを1行に表示するようにすることはできますか?

ご協力いただきありがとうございます。

答えて

1

使用prepend代わりappend

CSS:

.closeon { float: right; } 

JS

eventRender: function(event, element) { 
    var e = element.prepend("<span class='closeon'>&#10005;</span>"); 

    e.children('.closeon') 
     .attr('data-event-id', event._id) 
     .click(function() { 
      var id = $(this).attr('data-event-id'); 
      $('#calendar').fullCalendar('removeEvents',id); 
     });    
} 

[http://jsfiddle.net/8fa0j9d8/]

関連する問題