Показать сообщение отдельно
  #5 (permalink)  
Старый 15.02.2013, 19:10
Аватар для рони
Профессор
Отправить личное сообщение для рони Посмотреть профиль Найти все сообщения от рони
 
Регистрация: 27.05.2010
Сообщений: 33,075

foreach,
<!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" />
<script src="http://code.jquery.com/jquery-latest.js"></script>
<style type="text/css">
body {
   height: 1000px
}
#spacer {
    position: relative;
    top: 500px;
	width: 300px;
	height: 100px;
    background-color: #FF0066;
	}
#status {
    position:  fixed;
    top: 0px;
	width: 300px;
	height: 30px;
    background-color:  #66FFFF;
	}
</style>
<script type="text/javascript">
$(document).ready(function (){
$(window).scroll(function () {
			var spac = $(window).height();
			var pos = Math.round($('#spacer').position().top) ;
            var scroll =  $(window).scrollTop()
            $('#status').text('h = '+spac+'  p= '+pos + ' s = '+scroll + ' show =  ' + (spac+scroll > pos));

        });
});
</script>
</head>
<body>
<div id='status'>
</div>
<div id='spacer'>
</div>
<script>
</script>
</body>
</html>
Ответить с цитированием