CSS クラスの存在に応じて関数を破棄しようとしています。
class を確認したいのですが.active
、このクラスはボタンをクリックすることで切り替えられます。使ってみた
if(jQuery(#test).hasClass('.active')
しかし、クラス.active
の削除後に破棄したいのに、この関数がまだ実行されている場合は、一度しか機能しません。.active
私も試し.unbind()
ましたが無駄でした。
.active
クラスを削除した後、この関数を完全に破棄する方法を教えてください
function destroy_no_active_class(){
jQuery('#test.active').mouseover(function (e) {
e.stopPropagation();e.preventDefault();
jQuery(this).addClass('highlight');
}).mouseout(function () {
jQuery(this).removeClass('highlight');
}).click(function(e){
e.stopPropagation();
e.preventDefault();
show_data(this);
});
});
}