冒号后的Javascript函数

问题描述

在第一个示例中,仅添加了“ .click”,而在第二个示例中,除了“ .draggable”之外,紧随其后还有“ drag:”

在Example2中,为什么必须添加“拖动:”,它有什么作用?没有它,代码功能会一样吗?

    Example1: 
     $.connection.hub.start().done(function () {
                    $('#sendmessage').click(function () {
                        // Call the Send method on the hub. 
                        chat.server.send($('#displayname').val(),$('#message').val());
                        // Clear text Box and reset focus for next comment. 
                        $('#message').val('').focus();
                    });
                });
    
    Example2: 
     $.connection.hub.start().done(function () {
                    $shape.draggable({
                        drag: function () {
                            shapeModel = $shape.offset();
                            moveShapeHub.server.updateModel(shapeModel);
                        }
                    });
                });

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)