Toggle visibility property of div
Using jQuery:
$('#play-pause').click(function(){ if ( $('#video-over').css('visibility') == 'hidden' ) $('#video-over').css('visibility','visible'); else $('#video-over').css('visibility','hidden');});
According to the jQuery docs, calling toggle()
without parameters will toggle visibility.
$('#play-pause').click(function(){ $('#video-over').toggle();});
There is another way of doing this with just JavaScript. All you have to do is toggle the visibility based on the current state of the DIV's visibility in CSS.
Example:
function toggleVideo() { var e = document.getElementById('video-over'); if(e.style.visibility == 'visible') { e.style.visibility = 'hidden'; } else if(e.style.visibility == 'hidden') { e.style.visibility = 'visible'; }}