Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Aug 2004
    Location
    Uppsala, Sweden
    Posts
    94
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Hiding an iframe & still keeping it active...

    I've done this little page where a mp3player is "folded" out when you hit show, and goes away when you hit hide.

    However. When the player is hidden playback stops, and reloads when shown again. How can I work around this?


    Code:
    	<script type="text/javascript">
    	<!--
    		function Show_MP3() {
    			var fr = document.getElementById ("mp3player_frame");
    				fr.style.display="block";
    		 }
    		function Hide_MP3() {
    			var fr = document.getElementById ("mp3player_frame");
    				fr.style.display="none";
    		 }
    	//-->
    	</script>
    
    
    <div id="mp3player" align="center" style="bottom:0px; right:20px; position:fixed; z-index:1; border:0px;">
    	<font class="f5">MP3 Player: </font>
    	<a href="javascript:Show_MP3()" class="a6">Show</a>
    	<font class="f5"> | </font>
    	<a href="javascript:Hide_MP3()" class="a6">Hide</a>
    	<br />
    	<iframe id="mp3player_frame" src="mp3player.php" width="160px" height="132px" scrolling="no">
    	</iframe>
    </div>

  • #2
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,927
    Thanks
    6
    Thanked 1,041 Times in 1,014 Posts
    Hmm, don’t know exactly but how about using visibility: hidden instead of display: none?
    Code:
    			var fr = document.getElementById ("mp3player_frame");
    				fr.style.visibility="visible";
    		 }
    		function Hide_MP3() {
    			var fr = document.getElementById ("mp3player_frame");fr.style.visibility="hidden";

  • #3
    New Coder
    Join Date
    Aug 2004
    Location
    Uppsala, Sweden
    Posts
    94
    Thanks
    0
    Thanked 0 Times in 0 Posts
    That worked, however. it still takes up space. my menu for showing/hiding is above the player and it looks much nicer when the space is gone too.

    Edit:
    RE-did it by putting the player above the menu. look great now and works great
    Last edited by Noumenon; 07-19-2007 at 12:05 PM.

  • #4
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,927
    Thanks
    6
    Thanked 1,041 Times in 1,014 Posts
    You can set its position to absolute, though. That will take it out of the regular flow of elements, hence not taking up any space on the page.

  • #5
    New Coder
    Join Date
    Aug 2004
    Location
    Uppsala, Sweden
    Posts
    94
    Thanks
    0
    Thanked 0 Times in 0 Posts
    yeah. but that would mean that the menu would be at the bottom all of time. Like it is now. When shown I want it to take up space, but when hidden not to take up space, but still be active.

    but like I said, I went the way of putting the player above the menu and used visibility instead. works great


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •