函数可排序(Mootools 库)
我在使用 Sortables() 函数(Mootools 库)时遇到问题。
this.sort=new Sortables(this.box,{
onStart: function(el){el.setStyles({'background':'#f0f0f0','opacity':1});},
onComplete: function(el){el.setStyle('background','none');this.setEditor();}.bind(this)
});
事实上,我有一个 DIV,其中包含其他应该可排序的 DIV 块。第二级 DIV 内部有 SELECT 标签。
问题是这些下拉列表在单击时不会下降。单击恰好落在父 DIV 元素上,并且 onStart 函数启动。如何解决这个问题呢?
I have a problem while using the Sortables() function (Mootools library).
this.sort=new Sortables(this.box,{
onStart: function(el){el.setStyles({'background':'#f0f0f0','opacity':1});},
onComplete: function(el){el.setStyle('background','none');this.setEditor();}.bind(this)
});
In fact, I have a DIV, which contains other DIV blocks which should be made sortable. And the 2nd level DIVs have SELECT tags inside.
The problem is these dropdown list does not drop when clicked. The click just falls to the parent DIV element and onStart functions starts. How can this problem be solved?
The prototype: http://jsfiddle.net/uCM2R/3/
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
穆工具1.12?呵呵。
正确的。所以基本上您希望单击下拉列表而不触发排序?这将很棘手,因为它在父级上使用委托事件并且它会冒泡。此外,在选择上编写点击事件脚本也不可靠,因此您无法阻止点击事件可靠地传播 - 至少在 1.12 中是这样。 1.3.2 没问题。
考虑在 select 上使用
handles: "div.foo"
选项,这是一个子 div,允许他们移动东西而不是整个 div。http://jsfiddle.net/dimitar/uCM2R/4/
显然在
div.foo
句柄上可以放一些表示移动的图标。只有它们将充当排序的拖动点,从而使您能够在没有干扰的情况下进行选择。根据您的原始规范/标记,它位于 1.3.2 中: http://jsfiddle.net/dimitar /uCM2R/6/
添加了一个用于停止冒泡的选择的单击处理程序。
mootools 1.12? heh.
right. so basically you want a click on the dropdown not to trigger the sort? this will be tricky as it uses a delegated event on the parent and it bubbles. also, scripting click events on a select is not reliable either so you cant stop the click event from propagating reliably - at least in 1.12. 1.3.2 is fine.
consider using the
handles: "div.foo"
option on the select whereby thats a child div that allows them to move things as opposed to the whole div.http://jsfiddle.net/dimitar/uCM2R/4/
obviously in the
div.foo
handle you can put some icons that indicate moving. only they will act as the drag point for sorting, thus enabling you to work with selects w/o interference.here it is in 1.3.2 as per your original spec/markup: http://jsfiddle.net/dimitar/uCM2R/6/
added a click handler for selects that stops the bubbling.