html5 - how to swap sections with javascript -


i'm beginner html5 , javascript , i'd create basic function swap section's positions event.

the function 1 working, swapping section "con" top, function 2 doesn't work.

please, can me?

function swap1()  { document.getelementbyid("top").style.position = "absolute";   document.getelementbyid("con").style.top = "50px"; }  function swap2()  { document.getelementbyid("con").style.position = "fixed";  document.getelementbyid("top").style.bottom = "300px"; } 

<section id="top" onmousedown="swap1()">  <video width="500" height="500" controls>     <source src="http://techslides.com/demos/sample-videos/small.mp4" type=video/mp4> </video>  </section>    <section id="con" onmouseover="swap2()">  <hr>  <p>text.</p>  </section> 

it because after running ur first function, section con goes behind top section thats why can see u cant fire mouseover function on [con] section..

u have set z-index achieve that.

check out http://jsbin.com/izusar/1/


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -