cmb Posted July 17, 2012 Share Posted July 17, 2012 right now this is my code for clicking a button and it shows a div, click it again and it disappears. what i want to do is i just show that div on top of the rest how would i modify this to do that function toggle_visibility(id) { var e = document.getElementById(id); if(e.style.display == 'none') e.style.display = 'block'; else e.style.display = 'none'; } Quote Link to comment Share on other sites More sharing options...
avibitton Posted July 18, 2012 Share Posted July 18, 2012 use something like this . its the show function in jquery in its preety cool and simple . hope it helps . Avi. (you can create html page with this code just to check how its work for you , this example been taken from http://api.jquery.com/show/ ) <!DOCTYPE html> <html> <head> <style> div { background:#def3ca; margin:3px; width:80px; display:none; float:left; text-align:center; } </style> <script src="http://code.jquery.com/jquery-latest.js"></script> </head> <body> <button id="showr">Show</button> <button id="hidr">Hide</button> <div>Hello 3,</div> <div>how</div> <div>are</div> <div>you?</div> <script> $("#showr").click(function () { $("div").first().show("fast", function showNext() { $(this).next("div").show("fast", showNext); }); }); $("#hidr").click(function () { $("div").hide(1000); }); </script> </body> </html> Quote Link to comment Share on other sites More sharing options...
MarPlo Posted July 19, 2012 Share Posted July 19, 2012 Hi, That DIIV should have position:absolute; and z-index:9990; set in CSS style. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.