each
以下のステートメントに非表示の div を含める方法を見つける必要があります。答えが見つからないようです。隠し要素の子だけではないので、に基づいて書くことはできませんdisplay:none
$("div").each(function(){
if ($(this).hasScrollBar()){
$(this).addClass('scrollable');
}
});
hasScrollBar 関数:
(function($) {
$.fn.hasScrollBar = function() {
return this.get(0).scrollHeight > this.innerHeight();
}
})(jQuery);