I am new in java script.
I have facebook style right side bar, which show all new event/post updated by friends. Here I used a ajax to load a individual php inside a div on current page.
Its working well but not work as facebook.
Question 1: I just want its(Ticer div) perpand new event/post if found on indivisual php after 10 second. How to do it.
Question 2: How to show full Event/post on hover of particular event in this ticker like facebook. I used a hover script here which I cannot hide on click anywhere of body.
My ajex for load div:
$.ajaxSetup({ cache: false });
var auto_refresh = setInterval(function() {
$('#updatetime').load('updateside.php?');
}, 10000); // refresh every 10000 milliseconds
My hover script
$(".upbox1").mouseover(function() {
var pos = $(this).position();
var width = $(this).outerWidth();
$("#menu").css({
position: "absolute",
top: pos.top + "px",
left: (pos.right + width) + "px"
}).show();
});
php:
$a= mysqli_query // Which find out all followers of me
$b= mysqli_query // which find out all of my activ post/parent id
// Updateside a particular table which add total user all post updates
// So I need a parent id/post which is related with a user activity.
$g = mysqli_query($dbh,"SELECT parent_id FROM updateside WHERE `from_id`='".$followname."' OR `to_id`='".$followerbdid."' OR `from_id`='".$session->username."' OR `to_id`='".$session->bdid."' GROUP BY parent_id DESC") or die(mysqli_error($dbh));
while ($row = mysqli_fetch_array($g)) {
$parent = $row['parent_id'];
$u = mysqli_query($dbh,"SELECT * FROM updateside WHERE `parent_id`='".$parent."' ORDER BY created DESC") or die(mysqli_error($dbh));
while ($row = mysqli_fetch_array($u)) {
$from_id = $row['from_id'];
$parent_id = $row['parent_id'];
$to_id = $row['to_id'];
$sub = $row['sub'];
$detail = $row['detail'];
$img = $row['img'];
$time = $row['created'];
echo"result will be goes here";