Sunday 15 May 2011

javascript - How could I show an hidden div when a page is loaded? -


I have a scene with div in which "code" displays: any now as a style I want to show it when loading another page, and also check whether the div is already shown or not. I tried without success with it:

  & lt; Div onload = "music_player ()" & gt; - & lt; / Div & gt; & Lt; Script & gt; Function music_player () {document.getElementById ('thumb'). Style.display = 'block'; } & Lt; / Script & gt;  

jQuery makes it very easy for you to use to show your element Handler In addition, your pseudo-selector makes it easy to determine that an element is currently hidden.

  $ (document) .ready (function () {var isShown = $ ("#thumb: visible"), Length> gt; if (! Shown) {$ ( "# Thumbs"). Show ();}});  

No comments:

Post a Comment