jqxWidget jqxwindow打开脚本只工作一次

时间:2015-05-26 10:20:51

标签: javascript php jquery jqxwidgets

我有jqxWindow的JS代码,只能运行一次:

$(document).ready(function () {
    $("#jqxwindow1 ").jqxWindow({ height: 800, width: 1212, maxWidth: 1600, maxHeight: 900, animationType: 'none', theme: 'fresh', autoOpen: false  });
    $("#jqxwindow2 ").jqxWindow({ height: 800, width: 1212, maxWidth: 1600, maxHeight: 900, animationType: 'none', theme: 'fresh', autoOpen: false  });
    $("#jqxwindow3 ").jqxWindow({ height: 800, width: 1212, maxWidth: 1600, maxHeight: 900, animationType: 'none', theme: 'fresh', autoOpen: false  });
    $("#jqxwindow4 ").jqxWindow({ height: 800, width: 1212, maxWidth: 1600, maxHeight: 900, animationType: 'none', theme: 'fresh', autoOpen: false  });
    $("#jqxwindow5 ").jqxWindow({ height: 800, width: 1212, maxWidth: 1600, maxHeight: 900, animationType: 'none', theme: 'fresh', autoOpen: false  });

$('div[id^="test"] p').click(function() {
    var string = "#jqxwindow" + $(this).text().split('|')[0];
    //alert("The window is opened : " + string);
    var opened = $(string).jqxWindow('isOpen');
    var action = 'close';
    if (opened == false)
        action = 'open';
        $(string).jqxWindow(action);
        $(string).jqxWindow('bringToFront');
    });
});

我在搜索,但每个解决方案都不适合我。

LE

  

未捕获的TypeError:$(...)。jqxWindow不是函数

在线

var opened = $(string).jqxWindow('isOpen');

1 个答案:

答案 0 :(得分:0)

我解决了: 刚刚放入(文档)jQuery并在函数中放入参数$。恩。下:

         jQuery(document).ready(function ($) {
//function code
    }

现在它已经发挥作用了。