web-dev-qa-db-ja.com

(ajax on) 'better_exposed_filters'モジュールでフィルタリングすると、ビューのjqueryスクリプトが機能しない

ノード画像ホバーを処理するためのスクリプトがあります

(function ($) {
    $(function(){

    $('.node-photos-teaser').mouseenter(function() {
        $(this).addClass('photos-hover');
    }).mouseleave(function() {
        $(this).removeClass('photos-hover');
    });     


});
})(jQuery);

ajaxを使用して 'better_exposed_filters'で設定されたノードフィルターをクリックすると、POST drupal/views/ajax?field_tags_tid_1 = 4が読み込まれ、ノードが正常に除外されますが、JQueryの動作は機能しなくなります。

Ajaxがjqueryを壊す

何か助けは?

2
Matoeil

Cliveの回答のおかげで、テーマスクリプトファイルに埋め込む問題を解決できました。

 Drupal.behaviors.betterExposedFilters = {
    attach: function(context) {  }}

今持っている:

 (function ($) {
Drupal.behaviors.betterExposedFilters = {
        attach: function(context) {         

    $('.node-photos-teaser').mouseenter(function() {
        $(this).addClass('photos-hover');
    }).mouseleave(function() {
        $(this).removeClass('photos-hover');
    });


        }}
})(jQuery);

私のテーマのJQueryと、betterExposedFilterモジュールのajaxとの互換性をレンダリングします

1
Matoeil