index.php
<html>
<head>
<script type="text/javascript" src="jquerys/jquery.js"></script>
<style>
#parentcontainer div
{
height:900px;
width:600px;
clear:both;
border:1px solid red;
padding:10px;
margin:50px 0px;
}
</style>
<script>
function showHint()
{
$('div').load('getdivs.php');
$(window).scroll(function()
{
$( ':visible' ).filter('.same').each(function()
{
alert($(this).attr('id'));
});
});
}
</script>
</head>
<body onload="showHint()">
<p>Suggestions: <div class="same2" id="parentcontainer"></div></p>
</body>
</html>
getdivs.php
<div class="same" id="childcontainer1"> content here
</div>
<div class="same" id="childcontainer2"> content here
</div>
When I scroll down the window, I am getting the alerts of all the div
's with (.same) class irrespective of the div
I am viewing on the window. I want the ID's respective to the DIV'S shown on page on scrolling.