Scroll Example - Horizontal : Animation Scroll « Ajax Layer « JavaScript DHTML






Scroll Example - Horizontal


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Scroll Example - Horizontal</title>
<style type="text/css">
/*
Copyright (c) 2006, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
Version: 0.10.0
*/

body {
   margin:0;
   font:small arial;
}

h1 {
   color:#666;
   margin:0;
   font:bold 150% palatino, georgia;
}

#hd img {
   vertical-align:middle;
}

#hd h1 {
   display:inline;
   margin:0 0 0 20px;
   vertical-align:middle;
}

ul, li {
   margin:0;
   padding:0;
   list-style:none;
}

#doc {
   margin:10px;
}

#examples {
   margin:60px 40px;
}

#examples li {
   margin-bottom:1em;
}

#examples li a {
   color:#666;
   font:85% verdana;
}

#demo {
   background:#ccc;
   font:100%/1.2em arial;
   width:10px;
   height:10px;
}

#animation-demo-scroll #demo p {
   width:600px;
}

#animation-demo-motion #demo {
   color:yellow;
   font-size:0;
}

#animation-demo-size-plus #demo, #animation-demo-fade #demo, #animation-demo-colors #demo {
   background:#ccc;
   font:100%/1.2em arial;
   width:200px;
   height:200px;
}
#animation-demo-colors #demo {
   border:3px solid #c3c;
}

#animation-demo-scroll #demo {
   width:400px;
   height:200px;
   overflow:auto;
}

#animation-demo-colors #demo {

}

#target {
   background:red;
   font-size:0;
   position:absolute;
   left:300px;top:300px;
   width:10px;
   height:10px;
}

</style>
<script type="text/javascript" src="./build/yahoo/yahoo.js"></script>
<script type="text/javascript" src="./build/event/event.js"></script>
<script type="text/javascript" src="./build/dom/dom.js"></script>
<script type="text/javascript" src="./build/animation/animation.js"></script>

<script type="text/javascript">
YAHOO.example.init = function() {
   var attributes = {
      scroll: { to: [200, YAHOO.util.Dom.get('demo').scrollTop] }
   };

   var anim = new YAHOO.util.Scroll('demo', attributes, 1, YAHOO.util.Easing.easeOut);
   YAHOO.util.Event.on(document, 'click', anim.animate, anim, true);
};

YAHOO.util.Event.onAvailable('demo', YAHOO.example.init);
</script>

</head>
<body id="animation-demo-scroll">
<div id="doc">
   <h1>Scroll Example - Horizontal</h1>
   <p>This example demonstrates how to animate an element's horizontal scroll position using the Scroll
    subclass.</p>
   <p>Click anywhere to start animation.</p>
   <div id="demo"><p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh 
   euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis 
   nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis 
   autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore 
   eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent 
   luptatum zzril delenit Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy 
   nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, 
   quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. 
   Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum 
   dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit 
   praesent luptatum zzril delenit Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam 
   nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim 
   veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo 
   consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat,
    vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui 
    blandit praesent luptatum zzril delenit Lorem ipsum dolor sit amet, consectetuer adipiscing elit,
     sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim
      ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea
       commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie
        consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto 
        </p></div>  
</div>
</body>
</html>

           
       








yui.zip( 3,714 k)

Related examples in the same category

1.Scroll Example - Scroll By
2.Scroll Example - Vertical