Ok so heres my problem: I need the top div to only slide up/down when the mediaPlayerWrapper is there and not when the content_text is there. both are created using Ajax and php and only one exists at a time. As per my code bellow it works fine in the mediaPlayerWrapper but unfortunately it still slides in the content_text. any Ideas?
$(document).ready(function(){
$("#main_content").ajaxStop(function(){
if ($("#content_text").length){
}
else if($("#mediaPlayerWrapper").length){// Slide top and bottom bars when video wrapper is displayed
$("#top").slideUp(2000); //slide up(hide) DIV's
var timer;
$('html').mousemove(function(e) { //slide(show) DIV's down on mouse move
if(window.lastX !== e.clientX || window.lastY !== e.clientY){ //Check to see if mouse has moved before running code
$('#top').slideDown(2000);
clearTimeout(timer);
timer = setTimeout(function(){
$('#top').slideUp(2000)//<--- this is the line that is causing the problem
}, 5000);//slide back up after 5 seconds
}
window.lastX = e.clientX //stores the current x coordinate
window.lastY = e.clientY // stores the current y coordinate
});
}
});
sorry I cannot provide a fiddle or link to the site. });