单击事件拖动某一项时,火灾(火狐) [英] click event that fires when dragging an item (Firefox)

查看:175
本文介绍了单击事件拖动某一项时,火灾(火狐)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我点击一个项目,我可以编辑字段感谢引导编辑。结果
当我拖放项目我能项目由于位置改变 jquery.ui .sortable

When I click on an item I can edit the field thanks to bootstrap-editable.
When I drag and drop the item I am able to change the position of the item thanks to jquery.ui.sortable.

使用谷歌浏览器一切正常。结果
通过使用Firefox 15.0.1 我有以下问题。

Using Google Chrome everything works fine.
By using Firefox 15.0.1 I have the following issue.

在我移动的项目,它出现在弹出编辑的字段。结果
我想这事件是由于事件传播。结果
我试图修复它,但没有成功...

After I move the item, it appears the popup to edit the field.
I suppose this event is due to the event propagation.
I tried to fix it but with no success…

下面是我的一块code:

Here is my piece code:

    onSortReceive: function (e, ui) {
        this.$(ui.item[0]).trigger('drop', this.options.taskType);
        // TODO just on firefox there is a issue related to bootstrap-editable
        // it shows the popup even if there is e.stopPropagation() here
        // the only way to fix this issue is to re-render the view
        e.stopPropagation(); // it makes no difference 
        this.render(); // it fix the problem 
                       // but I want to avoid to re-render the view
    },

有关完整code,你可以去上:结果
https://github.com/antonioJs/CoCoTask/pull/21/files

For the full code you can go on:
https://github.com/antonioJs/CoCoTask/pull/21/files

有关工作的版本,你可以去:结果
http://computerone.altervista.org/CoCoTask/ (问题仅仅是与Firefox)

For the working version you can go on:
http://computerone.altervista.org/CoCoTask/ (the problem is just with firefox)

不知道如何解决这一问题?

Any idea how to fix the problem?

感谢

推荐答案

好吧,这里是一个工作方式,我发现。在你的 taskItem.js 替换的OnRender 与下面code:

Okay, here is one working way i found. In your taskItem.js replace onRender with following code:

    onRender: function () {
        var sortInAction = false;
        this.$el.find('label').mouseup(function(e) {
          sortInAction = 'absolute' === $(e.target).closest('li').css('position');
        }).click(function(e) {
            if (sortInAction)
              e.stopImmediatePropagation();
        }).editable({
            type: 'textarea',
            name: 'task-name',
            validate: this.editTaskName,
            template: '<textarea rows="3"></textarea>'
        });
    },

希望它帮助。

这篇关于单击事件拖动某一项时,火灾(火狐)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆