Showing posts with label show. Show all posts
Showing posts with label show. Show all posts

Thursday, June 25, 2015

hide/show with animation in Swift

For hiding the dock like view and show again

 func hide(sender: AnyObject)
 {
     let frame = hideshowView?.frame
     let height = frame?.size.height
     let offsetY = height!
        
     //hide after 10 seconds delay
     if frame != nil {
     UIView.animateWithDuration(0.5, delay: 10.0, options: UIViewAnimationOptions.CurveEaseIn, animations: { [weak self] () -> Void in
                
                if let weakSelf = self
                {
                    weakSelf.segmentedControl?.frame = CGRectOffset(frame!, 0, offsetY)
                    weakSelf.openBottomBarButton.hidden = false
                }
            }) { (Bool v) -> Void in
            }
      }
 }
    
 func show(sender: AnyObject)
 {
        let frame =  hideshowView?.frame
        let height = frame?.size.height
        let offsetY = -height!
        
        //show without delay
        UIView.animateWithDuration(0.5)
        {
            hideshowView?.frame = CGRectOffset(frame!, 0, offsetY)
        
        }
}

Thursday, July 28, 2011

Simple method to show/hide using javascript


  • Place this script at the beginning of the html code:

<script type="text/javascript">

function showhide(ThisObj)

{

      nav=document.getElementById(ThisObj);

      if(nav.style.display=="none")

          nav.style.display='block';

      else

          nav.style.display='none';

 }

</script>

  • Give a link (either a plus sign or some text or even a button) for the content to be shown or hidden:

<div onclick="showhide('step')" >link name</div>

  • The content to be shown or hidden (expanded) needs to be placed within this div tag:

<div id="step" style="display: none;"> content to be shown and hidden </div>