Advertisement
aknath

Adding a text slider

May 26th, 2014
261
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 1.44 KB | None | 0 0
  1. <script type="text/javascript" src="http://code.jquery.com/jquery-1.11.1.js"></script>
  2. <script type="text/javascript">
  3.     jQuery(function($){
  4.         $('#main_imag').load(function() {
  5.             setTimeout(function() {
  6.                 $('#text1').animate({
  7.                     left: 0
  8.                 })
  9.             }, 1000);
  10.             setTimeout(function() {
  11.                 $('#text2').animate({
  12.                     left: 0
  13.                 })
  14.             }, 2000);
  15.             setTimeout(function() {
  16.                 $('#text3').animate({
  17.                     left: 0
  18.                 })
  19.             }, 3000);
  20.         });
  21.     });
  22. </script>
  23. <div id="slide-wrap">
  24.     <img id="main_imag" src="image.jpeg" width="300px">
  25.     <span id="text1">Lorem ipsum</span>
  26.     <span id="text2">Lorem ipsum</span>
  27.     <span id="text3">Lorem ipsum</span>
  28. </div>
  29. <style>
  30.     #slide-wrap{
  31.         width: 300px;
  32.         position: relative;
  33.     }
  34.     #text1{
  35.         position: absolute;
  36.         top: 20px;
  37.         left: -500px;
  38.         display: block;
  39.         text-align: center;
  40.         width: 100%;
  41.     }
  42.     #text2{
  43.         position: absolute;
  44.         top: 50px;
  45.         left: -500px;
  46.         display: block;
  47.         text-align: center;
  48.         width: 100%;
  49.     }
  50.     #text3{
  51.         position: absolute;
  52.         top: 80px;
  53.         left: -500px;
  54.         display: block;
  55.         text-align: center;
  56.         width: 100%;
  57.     }
  58. </style>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement