Ver Mensaje Individual
  #3 (permalink)  
Antiguo 09/06/2011, 14:08
Avatar de livemusic
livemusic
 
Fecha de Ingreso: abril-2011
Ubicación: Lima - Chorrillos
Mensajes: 150
Antigüedad: 13 años
Puntos: 18
Respuesta: Validar scroll con jquery

Encontre esta otra funcion xD....


Código HTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Documento sin título</title>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>
<script>
$(function(){
	
	if($('#my_div1').hasScrollBar() == true){
		alert('content 1: ' + $('#my_div1').hasScrollBar());
	}
	
	if($('#my_div2').hasScrollBar() == true){
		alert('content 2: ' + $('#my_div2').hasScrollBar());
	}
    
});

(function($) {
    $.fn.hasScrollBar = function() {
        return this.get(0).scrollHeight > this.height();
    }
})(jQuery);
</script>
</head>

<body>
<div id="my_div1" style="width: 100px; height:100px; overflow:auto;" class="my_class">
  * content 1
    <br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
</div>

<div id="my_div2" style="width: 100px; height:100px; overflow:auto;" class="my_class">
  * content 2
</div>
</body>
</html> 

Saludos suerte :D....