$('#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'
属性等),但这对我没有帮助。我还有什么办法可以解决这个问题吗?谢谢。