github.com/EngineerKamesh/gofullstack@v0.0.0-20180609171605-d41341d7d4ee/volume3/section1/basics/client/cssexample.go (about)

     1  package main
     2  
     3  import "honnef.co/go/js/dom"
     4  
     5  func toggleIsomorphicGopher(isVisible bool) {
     6  
     7  	d := dom.GetWindow().Document()
     8  	isomorphicGopherImage := d.GetElementByID("isomorphicGopher").(*dom.HTMLImageElement)
     9  
    10  	if isVisible == true {
    11  		isomorphicGopherImage.Style().SetProperty("display", "inline", "")
    12  	} else {
    13  		isomorphicGopherImage.Style().SetProperty("display", "none", "")
    14  	}
    15  
    16  }
    17  
    18  func ShowIsomorphicGopher() {
    19  	toggleIsomorphicGopher(true)
    20  }
    21  
    22  func HideIsomorphicGopher() {
    23  	toggleIsomorphicGopher(false)
    24  }