我将Fullcalendar与调度程序一起使用。当我尝试将事件从事件列表拖到日历上时-工作正常,但是当我将其拖到然后使用滚动时-事件将停留在您将其拖到的位置,并且光标会根据事件的位置进行更改滚动。所以,这是我的代码:
$('#external-events .fc-event').each(function() {
// store data so the calendar knows to render an event upon drop
$(this).data('event', {
title: $.trim($(this).text()), // use the element's text as the event title
stick: true // maintain when user navigates (see docs on the renderEvent method)
});
// make the event draggable using jQuery UI
$(this).draggable({
cursorAt: {
left: 5,
top: 5
},
zIndex: 999,
refreshPositions: true,
revert: true, // will cause the event to go back to its
revertDuration: 0 // original position after the drag
});
});
#external-events {
width: 100%;
height: 850px;
overflow-y: auto;
overflow-x: hidden;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.css" />
<section id="calendar"></section>
<section id="external-events">
<div class="fc-event event-to-drop">
<p>Some content here</p>
</div>
<div class="fc-event event-to-drop">
<p>Some content here</p>
</div>
</section>
我尝试了在互联网上找到的解决方案(用容器包装,并为其提供position: relative;
样式,appendTo: 'body', helper: 'clone'
属性等),但并没有帮助我。还有什么我可以用来解决这个问题的东西吗?谢谢。