sle*_*lex 10 html javascript jquery
<div class="scrollable" style="overflow: hidden"> </div>
$(function() {
if($(".scrollable").hasElementsInsideItThatAreCutOffByOverflowHidden == false){
$(".scrollable").scrollable({ vertical: true, mousewheel: true });
}
}
<a onClick="isHidingMyStuff"> check if your stuff is hidden <a>
Run Code Online (Sandbox Code Playgroud)
这不起作用
Gab*_*oli 15
我们将内容包装在一个div中,这样我们就可以从中获得一个高度并与.scrollable高度进行比较(不可滚动..)
function isHidingMyStuff(){
var $s = $('.scrollable');
$s.wrapInner('<div />'); // wrap inner contents
var hidden = $s.height() < $s.children('div').height();
$s.children('div').replaceWith( $s.children('div').html() ); //unwrap
return hidden;
}
Run Code Online (Sandbox Code Playgroud)
演示http://jsfiddle.net/gaby/ApZP2/
| 归档时间: |
|
| 查看次数: |
6212 次 |
| 最近记录: |