+48 511 790 336

szymon@artmetic.pl

Hide css class/button on sites.


How to hide or show class

<script>
   if(window.location.pathname == "/my_url_site/site" || window.location.pathname == "/category/poduct")
	   {
		document.getElementById("myButtonClass").style.visibility = "visible"; 
	   }
</script>

in CSS it is defined in that way:

.myButtonClass{
	background: blue; 
	visibility: hidden;
}

In html code you should declare:

<div class="myButtonClass"> text or something else.. </div>
Tagi: , , , ,

Dodaj komentarz

Twój adres email nie zostanie opublikowany. Pola, których wypełnienie jest wymagane, są oznaczone symbolem *

This site uses Akismet to reduce spam. Learn how your comment data is processed.