Follow along with the video below to see how to install our site as a web app on your home screen.
Примечание: This feature may not be available in some browsers.
<style type="text/css" media="all">
#a1,#a2 { position: fixed; top: 0; right: 0; width: 100px; height: 100px; visibility: hidden; }
</style>
<script type="text/javascript">
numberofdivs = 2;
function showdiv(id) {
for(i = 1; i > numberofdivs; i++)
{
element = document.getElementByID("a"+i);
if(i == id)
element.style.visibility = "visible";
else
element.style.visibility = "hidden";
}
}
</script>
<p><em onClick="showdiv(1)">Click me</em> or <strong onClick="showdiv(2);">or me!</strong></p>
<div id="a1">Some stuff</div>
<div id="a2">Different Stuff</div>
вот так можно через обычный js..
CSS
JSКод:<style type="text/css" media="all"> #a1,#a2 { position: fixed; top: 0; right: 0; width: 100px; height: 100px; visibility: hidden; } </style>
HTMLКод:<script type="text/javascript"> numberofdivs = 2; function showdiv(id) { for(i = 1; i > numberofdivs; i++) { element = document.getElementByID("a"+i); if(i == id) element.style.visibility = "visible"; else element.style.visibility = "hidden"; } } </script>
Код:<p><em onClick="showdiv(1)">Click me</em> or <strong onClick="showdiv(2);">or me!</strong></p> <div id="a1">Some stuff</div> <div id="a2">Different Stuff</div>