Search
 
SCRIPT & CODE EXAMPLE
 

CSS

slide up and down animation css

.my-div{
  background-color: #f00;
  animation: animationname 2s linear infinite;
  /*animation: animation-name animation-duration animation-direction animation-iteration-count */  
  transition: .5s ease-in-out;
}
@keyframes animationname{
  0%{
    transform: translateX(10px);
  }
  100%{
    transform: translateX(-10px);
  }
Comment

CSS slide up animation

//HTML

<div class="container">
  <a href="#" class="button">Hide Him!</a>
  <div class="slider">
    <h1>I'm here to be hidden. ;-)</h1>
    <p>Bacon ipsum dolor sit amet swine jerky jowl pork belly sausage brisket, beef ribs meatloaf chuck beef. Flank corned beef prosciutto cow. Pork tail swine meatball brisket cow. Turducken short loin doner pork belly frankfurter flank kevin ball tip meatloaf ham capicola. Tri-tip meatloaf pancetta tenderloin frankfurter shoulder swine turkey porchetta strip steak biltong pork. Bresaola turkey boudin filet mignon spare ribs jowl t-bone kevin tri-tip brisket chuck beef ribs.</p>    
  </div>
</div>


//js
$( document ).ready( function() {
  var button = $('.button');
  var slider = $('.slider');
  
  button.on('click', function(e) {
    
    if ( slider.hasClass('closed') ) {
      button.text('Hide Him!');
      slider.toggleClass('closed');
    } else {
      button.text('No, Bring Him Back!');
      slider.toggleClass('closed');
    }
    
  });
  
}); 


//CSS(SCSS)
@import "compass/css3";

// Slide down effect via css3
// No jQuery animation
// Taken from http://davidwalsh.name/css-slide

.slider {
	overflow-y: hidden;
	max-height: 500px; /* approximate max height */
  box-sizing: border-box;

	transition-property: all;
	transition-duration: .5s;
	transition-timing-function: ease;
}
.slider.closed {
	max-height: 0;
}



// slider styling
.slider {
  background-color: white;
  padding: 0 1em;
  margin: 1em 0;
  border-radius: .2em;
}

// Page styling 
body {
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  background-color: skyblue;
  line-height: 1.5;
  padding: 2em;
  color: #666;
}
.container {
  position: relative;
  margin: 0 auto;
  max-width: 480px;
  overflow: visible;
}

h1 {
  font-weight: 100;
  color: #222
}


.button {
  display: block;
  height: 2em;
  background-color: darkslategray;
  text-align: center;
  color: white;
  font-weight: 100;
  font-size: 2em;
  line-height: 2em;
  border-radius: .25em;
  text-decoration: none;
 
  &:hover {
    text-decoration: none;
    background-color: coral;
  }
  &:active {
    text-decoration: none;
    background-color: darken(coral,3%);
  }
}
Comment

PREVIOUS NEXT
Code Example
Css :: remove border select css 
Css :: border box reset 
Css :: checkbox remove styling 
Css :: css ecken abrunden 
Css :: css circle border 
Css :: css div side rounded 
Css :: css overflow y 3 dots 
Css :: JS make text not highlightable 
Css :: css rounded corners at top only 
Css :: add background overlay over background image 
Css :: css dynamic grid layout 
Css :: css blink 
Css :: boostrap pointer 
Css :: js click under 
Css :: how to make white image black in css 
Css :: link to css file within another css file 
Css :: hex code for khaki 
Css :: table td remove padding 
Css :: remove underline from <a HTML 
Css :: show hide item based on display size 
Css :: scroll tbody fixed thead 
Css :: css vertical align 
Css :: remove line accordion material ui 
Css :: text glow 
Css :: wordpress link post tags 
Css :: center css elements 
Css :: css change text spacing 
Css :: html5 video hide progress bar 
Css :: break word css 
Css :: hide input border on focus 
ADD CONTENT
Topic
Content
Source link
Name
6+2 =