-1

Possible Duplicate:
Fire jQuery event on div change

I'm using this tiny plugin to watch for changes in the html: https://github.com/jacobrelkin/jquery-watcher

This works fine, the problem is I need the if condition to validate if it's over 2 times, reason being when the gallery loads and it shifts left and right creates the -moz-grabbing condition twice onload.

I tried doing

  if(  $('#gallery-1').has('div').css('cursor', '-moz-grabbing') > 2)
  if(  $('#gallery-1').has('div').css('cursor', '-moz-grabbing').length > 2)

I also tried putting it in a variable then doing > 2

None of the above seem to be working not sure what I'm doing wrong?

$('.sliderContainer').watch('innerHTML', function() {
    if(  $('#gallery-1').has('div').css('cursor', '-moz-grabbing') ) {
        console.log($('#gallery-1').has('div').css('cursor', '-moz-grabbing'));
        $('#collapse_content_1').toggleClass('collapse_inner_off');
    }
});
4

1 に答える 1

1

.css('cursor', '-moz-grabbing')実際にスタイルシート ルールを設定します。おそらく使用したい.filter

$('#gallery-1').has('div').filter(function () {
   return $(this).css('cursor') == '-moz-grabbing';
}).length > 2
于 2012-11-28T22:26:30.293 に答える