dongye9228 2018-12-14 19:22
浏览 50

如果在php include中,jQuery UI draggable类不起作用

I am creating a notification system that refreshes a php file executing a query to display the notifications., and am making use of jquery ui draggable by adding the .draggable class to divs with success, but whenever the draggable div is included this way, it doesnt know its a draggable. Any thoughts on why its not seeing itself as a draggable?

I tried adding the draggable script and references to nudgecheck (the included php file where draggable is broken) but no luck.

nudgecheck:

 <div id='$nudgeid' class='draggable'>
 // mysql query content
 </div>

Code to refresh nudgecheck:

 <div id="notifications">
 </div
<script>
function showUser() {
var str = "<? echo $salesman;?>";
 xmlhttp = new XMLHttpRequest();
       xmlhttp.onreadystatechange = function() {
        if (this.readyState == 4 && this.status == 200) {
            document.getElementById("notifications").innerHTML = this.responseText;

        }
        else if (XMLHttpRequest.readyState == 0) {
        // Network error (i.e. connection refused, access denied due to CORS, etc.)
    }
    else {
        // something weird is happening
    }
    };
    xmlhttp.open("GET","/nudgecheck/?q="+str,true);
    xmlhttp.send();
 }




setInterval(function () {
  showUser();
}, 3000);

</script>

on the page that has #notifications div

        $(function() {
$(".draggable").draggable({ 
     revert: true,
     helper: "clone",
     cursorAt: { bottom: 0 },
     revertDuration: 1000,
     cursorAt: {
        bottom: 0,
        right: 0},
});
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥50 三种调度算法报错 有实例
    • ¥15 关于#python#的问题,请各位专家解答!
    • ¥200 询问:python实现大地主题正反算的程序设计,有偿
    • ¥15 smptlib使用465端口发送邮件失败
    • ¥200 总是报错,能帮助用python实现程序实现高斯正反算吗?有偿
    • ¥15 对于squad数据集的基于bert模型的微调
    • ¥15 为什么我运行这个网络会出现以下报错?CRNN神经网络
    • ¥20 steam下载游戏占用内存
    • ¥15 CST保存项目时失败
    • ¥20 java在应用程序里获取不到扬声器设备