我正在努力将我的帖子拖到类别中;我正在使用jQuery函数来实现可拖动和可放置的效果。但是,使用下面的jQuery droppable给我一个错误的轨道;
$(".display_type").droppable({
accept: ".brand_span",
hoverClass: "active",
drop: function(event, props) {
$("#display_container").load("brand_display/change",
{drag_id: $(props.draggable).attr("id"),
drop_id: $(this).attr("id")});
}
});
我收到错误消息;
SyntaxError: reserved word "function"
我知道我必须为Coffee JS改写它......我喜欢吗?
$(".display_type").droppable({
accept: ".brand_span",
hoverClass: "active",
drop: -> (event, props) {
$("#display_container").load("brand_display/change",
{drag_id: $(props.draggable).attr("id"),
drop_id: $(this).attr("id")});
}
});
答案 0 :(得分:0)
通过将上述内容转换为Coffee norm来计算出来;
$(".label").droppable
accept: ".entry"
hoverClass: "active"
drop: (event, props) ->
$("#content").load "brand_display/change",
drag_id: $(props.draggable).attr("id")
drop_id: $(this).attr("id")