我在这里看到了程序化的例子:
var fp;
require(["dojo/ready", "dojo/parser", "dojo/on","dojox/layout/FloatingPane", "dijit/form/Button"], function(ready, parser, on, FloatingPane, Button) {
ready(function() {
parser.parse();
fp = new FloatingPane({
title: "Test",
resizable: true,
dockable: false,
style:"position:absolute;top:0;left:0;width:100px;height:100px;visibility:hidden;",
id: "fp"
}, dojo.byId("fp"));
fp.startup();
on(fp._resizeHandle, "resize", function(e) {
// Event handler
console.log("test");
});
});
});
问题是,当我使用创建浮动窗格的声明方法时,我该怎么做?
答案 0 :(得分:0)
您可以使用dojo声明性脚本示例
见https://dojotoolkit.org/documentation/tutorials/1.10/declarative/
特别是"修改行为"
您将需要以下内容:
<script src="//ajax.googleapis.com/ajax/libs/dojo/1.10.4/dojo/dojo.js" data-dojo-config="parseOnLoad:true"></script>
<link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/dojo/1.10.4/dojo/resources/dojo.css">
<link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/dojo/1.10.4/dijit/themes/dijit.css">
<link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/dojo/1.10.4/dojox/layout/resources/FloatingPane.css">
<link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/dojo/1.10.4/dojox/layout/resources/ResizeHandle.css">
<div id="floatingPane" data-dojo-type="dojox/layout/FloatingPane"
data-dojo-props="title: 'Hello World!',resizable:true,dockable: false">
<p>I am a floating pane. That makes me happy See browser console for the resize event.</p>
<script type="dojo/aspect" data-dojo-advice="after" data-dojo-event="resize">
console.log("resize is executed");
</script>
</div>
&#13;