【发布时间】:2020-01-08 15:21:11
【问题描述】:
我对此有点陌生。
我正在尝试通过 ajax 从数据库加载外部事件。但是我遇到了 fc-events 类的可拖动属性的问题。
这是外部事件的 html
<div id='external-events'>
<p></p>
<h4>Sesiones</h4>
<div class="fc-event" id="sesiones"></div>
</div>
Ajax 调用
$(document).ready(function(){
$.ajax({
url:'http://localhost/eye/admin/ajax/mostrar_sesiones.php',
success: function(data){
$('#sesiones').html(data);
}
});
初始化外部事件
$('#external-events .fc-event').each(function() {
// make the event draggable using jQuery UI
$(this).draggable({
zIndex: 999,
revert: true, // will cause the event to go back to its
revertDuration: 0 // original position after the drag
});
还有来自 DB 的电话
<?php
session_start();
include_once('../../scripts/conexion.php');
$query = "SELECT Sesiones_ID, Sesion_nombre FROM sesiones";
if ($stmt = $con->prepare($query)) {
$stmt->execute();
$stmt->bind_result($Sesiones_ID, $Sesion_nombre);
$select="";
while ($stmt->fetch()) {
$select.="<div value=". $Sesiones_ID .">".$Sesion_nombre."</div>";
}
$stmt->close();
该图像显示了外部事件在该代码中的样子。
它确实可以拖放。但问题是我需要将“Sesiones#”分开。如果我在 DB 文件的 div 中添加类,则 Sesiones# 会出现分离但不保持可拖动属性。 (在浏览器调试器中检查,为每个 id 创建的 div 确实具有类)。
【问题讨论】:
-
为什么不把
margins加到你要分离的div上?
标签: php jquery html css fullcalendar