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

Slide Up/Down animation with CSS

//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 :: css disabled option 
Css :: docker registry fetch 
Css :: width height samsung note 20 screen 
Css :: false 
Css :: how to use style50 
Css :: how to pass html number to css 
Css :: CSS menu list with underline hover animation 
Css :: position inset css 
Css :: paste in form field cordova app 
Css :: nuxt css other site 
Css :: How to loop a javascript array 
Css :: how to highlight text in css 
Css :: tailwindcss link tag 
Css :: putting an object in front of a page javascript 
Css :: scss font color 
Typescript :: flutter run code every second 
Typescript :: Input elements should have autocomplete attributes (suggested: "current-password") 
Typescript :: react children typescript 
Typescript :: open two modal in chakra ui 
Typescript :: from sklearn.datasets import fetch_mldata error 
Typescript :: usewindowsize hook in nextjs 
Typescript :: if exists sql server 
Typescript :: string to date in typescript 
Typescript :: typescript space between capital letters 
Typescript :: mysql update if exists else insert 
Typescript :: typescript style type 
Typescript :: adonis load relationship 
Typescript :: count objects in selenium java 
Typescript :: bootstrap angular 
Typescript :: keyboard shortcuts spotify 
ADD CONTENT
Topic
Content
Source link
Name
1+8 =