Advertisement
ivana_andreevska

Animate with jQuery

Jan 17th, 2022
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4.     <meta charset="UTF-8">
  5.     <title>Title</title>
  6.     <link rel="stylesheet" href="jquery-ui.min.css">
  7.     <script src="jquery.js"></script>
  8.     <script src="jquery-ui.js"></script>
  9.     <style>
  10.         *{
  11.             margin: 0;
  12.             padding: 0;
  13.         }
  14.         .content-before {
  15.             color: white;
  16.             background-color: darkblue;
  17.             display: inline-block;
  18.         }
  19.  
  20.         .content-after {
  21.             display: none;
  22.             font-size: 14px;
  23.             font-family: arial;
  24.             color: #fff;
  25.             text-align: left;
  26.             Line-height: 16px;
  27.             opacity: 0;
  28.         }
  29.  
  30.         .content-box {
  31.             width: 240px;
  32.             height: 60px;
  33.             border-radius: 6px;
  34.             background-color: blue;
  35.             padding: 20px;
  36.         }
  37.     </style>
  38. </head>
  39.  
  40. <body>
  41. <div class="content-box">
  42.     <p class="content-before">Click me to see more</p>
  43.     <p class="content-after"> Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt
  44.         ut labore et dolore magna aliqua. Suspendisse interdum consectetur libero id. Turpis massa sed elementum tempus.
  45.         Cursus eget nunc scelerisque viverra mauris in. Pharetra pharetra massa massa ultricies mi quis. Luctus accumsan
  46.         tortor posuere ac ut consequat semper viverra nam. </p>
  47. </div>
  48.  
  49. <script>
  50.     $(document).ready(function () {
  51.         $(".content-box").click(function () {
  52.             $(".content-box").animate({
  53.                 width: '500px',
  54.                 height:'+=200px' //na default dodadi uste 200px
  55.             },1000 );
  56.         })
  57.         $(".content-after").show().animate({
  58.            opacity:"1"
  59.         },3000);
  60.     })
  61. </script>
  62. </body>
  63.  
  64. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement