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 :: how to limit css to min max large screen size 
Css :: null z transform hack 
Css :: inherit styles 
Css :: background shorthand code 
Css :: on hover active until i hover next css 
Css :: z-index: 1000000; 
Css :: css cotent tipe 
Css :: .cameleons 
Css :: sasas 
Css :: live sass compiler brackets 
Css :: @keyframes opact 
Css :: code-runner.executormap kotlin 
Css :: float pb 
Css :: div with no content have a width/height 
Css :: woocommerce product_cat apply to custom post type 
Css :: combine binary numbers 
Css :: position absolute prevent overflow 
Css :: css 30% height visible 
Css :: writting css with twin.macro and styled components 
Css :: on hover show text in bootstrap 
Css :: css every other element than self 
Css :: how to active horizental scroll for navbar menu in mobile screen 
Css :: scrollbar width css 
Css :: css cap rows paragraph 
Css :: react stateful 
Css :: rainvow hover css 
Css :: css beautiful project colors 
Css :: position inset css 
Css :: media query in css 
Css :: how to change the size of a style="text-align: center;" 
ADD CONTENT
Topic
Content
Source link
Name
8+2 =