0

jqueryを選択可能にして1時間の計画を立てています。

アイデアは単純です。複数選択が可能です。クリックすると、時間のオン/オフが切り替わります。Shift キーを押すと、フィールドが赤くなり、破壊されます。

コード:

$(function() {
    $("#selectable").bind("mousedown", function(event) {
        event.metaKey = true;
    }).selectable({
        selecting: function() {
            $(this).find('td.ui-selecting').addClass('potential');
            if (event.shiftKey == 1) {
                $(this).find('td.ui-selecting').addClass('destroy');
            }
        },
        stop: function() {
            $(this).find('td.ui-selected.destroy').removeClass('ui-selected potential');
            $(this).find('td.ui-selected.potential').removeClass('potential');
            $(this).find('td.destroy').removeClass('destroy');
        }
    });
    $("td.ui-state-default").click(function() {
        $(this).toggleClass('ui-selected');
    });
});​

実際の例を参照してください: http://studentify-static-pages.s3.amazonaws.com/calendar.html

今。単純なクリックが正しくできないようです。おそらく、以前にバインドしているからです。望ましい動作: 単純なクリック (つまり 0 なげなわ) で ui-select を切り替えます。

ヒントはありますか?ありがとう。

4

1 に答える 1

0

これを試して

$("ui-selectee ").on('click','td.ui-state-default' ,function() {
        $(this).toggleClass('ui-selected');
    });

イベントをその親に委任する

于 2012-10-08T22:22:46.853 に答える