|
|
Line 1: |
Line 1: |
- |
| |
| <html> | | <html> |
- | <head>
| |
- | <title>Expanding Image Menu with jQuery</title>
| |
- | <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
| |
- | <meta name="description" content="Expanding Image Menu with jQuery" />
| |
- | <meta name="keywords" content="menu, navigation, expanding, image, jquery, bw, slide out, hover, animate"/>
| |
- | <link rel="shortcut icon" href="../favicon.ico" type="image/x-icon"/>
| |
- | <link rel="stylesheet" type="text/css" href="css/style.css" />
| |
- | <link href='http://fonts.googleapis.com/css?family=Rock+Salt' rel='stylesheet' type='text/css' />
| |
- | <link href='http://fonts.googleapis.com/css?family=Raleway:100' rel='stylesheet' type='text/css' />
| |
- | </head>
| |
- | <body>
| |
- | <div class="container">
| |
- | <div class="header">
| |
- | <a class="left" href="http://tympanus.net/Tutorials/AnimatedContentMenu/"><<< Previous Demo: Animated Content Menu with jQuery</a>
| |
- | <a class="back" href="http://tympanus.net/codrops/2011/03/16/expanding-image-menu/">>>> back to the Codrops tutorial </a>
| |
- | </div>
| |
- | <div class="content">
| |
- | <h1>Expanding Image Menu with jQuery</h1>
| |
- | <h3>feat. Automatic Redial <a href="http://www.flickr.com/people/robnas/" target="_blank">by Robert Bejil Photography</a></h3>
| |
- | <div id="ei_menu" class="ei_menu">
| |
- | <ul>
| |
- | <li>
| |
- | <a href="#" class="pos1">
| |
- | <span class="ei_preview"></span>
| |
- | <span class="ei_image"></span>
| |
- | </a>
| |
- | <div class="ei_descr">
| |
- | <h2>Gary</h2>
| |
- | <h3>Vocals</h3>
| |
- | <p>
| |
- | A wonderful serenity has taken possession of my
| |
- | entire soul, like these sweet mornings of
| |
- | spring which I enjoy with my whole heart.
| |
- | </p>
| |
- | <p>
| |
- | I am alone, and feel the charm of existence in
| |
- | this spot, which was created for the bliss of
| |
- | souls like mine.
| |
- | </p>
| |
- | </div>
| |
- | </li>
| |
- | <li>
| |
- | <a href="#" class="pos2">
| |
- | <span class="ei_preview"></span>
| |
- | <span class="ei_image"></span>
| |
- | </a>
| |
- | <div class="ei_descr">
| |
- | <h2>David</h2>
| |
- | <h3>Guitar</h3>
| |
- | <p>
| |
- | A wonderful serenity has taken possession of my
| |
- | entire soul, like these sweet mornings of
| |
- | spring which I enjoy with my whole heart.
| |
- | </p>
| |
- | <p>
| |
- | I am alone, and feel the charm of existence in
| |
- | this spot, which was created for the bliss of
| |
- | souls like mine.
| |
- | </p>
| |
- | </div>
| |
| | | |
- | </li>
| + | <head> |
- | <li>
| + | |
- | <a href="#" class="pos3">
| + | <title>Panorama 360°</title> |
- | <span class="ei_preview"></span>
| + | |
- | <span class="ei_image"></span>
| + | <style> |
- | </a>
| + | html,body,div,span,h1,h2,h3,h4,h5,h6,p,img{margin:0;padding:0;border:0;outline:0;font-size:100%;vertical-align:baseline;background:transparent} |
- | <div class="ei_descr">
| + | body{line-height:1} |
- | <h2>Andrew</h2>
| + | a{margin:0;padding:0;font-size:100%;vertical-align:baseline;background:transparent} |
- | <h3>Bass</h3>
| + | html,body{width:100%;height:100%} |
- | <p>
| + | body{background-color:#777} |
- | A wonderful serenity has taken possession of my
| + | .round{border-radius:6px;-moz-border-radius:6px} |
- | entire soul, like these sweet mornings of
| + | </style> |
- | spring which I enjoy with my whole heart.
| + | |
- | </p>
| + | |
- | <p>
| + | |
- | I am alone, and feel the charm of existence in
| + | |
- | this spot, which was created for the bliss of
| + | |
- | souls like mine.
| + | |
- | </p>
| + | |
- | </div>
| + | |
- | </li>
| + | |
- | <li>
| + | |
- | <a href="#" class="pos4">
| + | |
- | <span class="ei_preview"></span>
| + | |
- | <span class="ei_image"></span>
| + | |
- | </a>
| + | |
- | <div class="ei_descr">
| + | |
- | <h2>Sean</h2>
| + | |
- | <h3>Drums</h3>
| + | |
- | <p>
| + | |
- | A wonderful serenity has taken possession of my
| + | |
- | entire soul, like these sweet mornings of
| + | |
- | spring which I enjoy with my whole heart.
| + | |
- | </p>
| + | |
- | <p>
| + | |
- | I am alone, and feel the charm of existence in
| + | |
- | this spot, which was created for the bliss of
| + | |
- | souls like mine.
| + | |
- | </p>
| + | |
- | </div>
| + | |
- | </li>
| + | |
- | <li>
| + | |
- | <a href="#" class="pos5">
| + | |
- | <span class="ei_preview"></span>
| + | |
- | <span class="ei_image"></span>
| + | |
- | </a>
| + | |
- | <div class="ei_descr">
| + | |
- | <h2>Marc</h2>
| + | |
- | <h3>Guitar</h3>
| + | |
- | <p>
| + | |
- | A wonderful serenity has taken possession of my
| + | |
- | entire soul, like these sweet mornings of
| + | |
- | spring which I enjoy with my whole heart.
| + | |
- | </p>
| + | |
- | <p>
| + | |
- | I am alone, and feel the charm of existence in
| + | |
- | this spot, which was created for the bliss of
| + | |
- | souls like mine.
| + | |
- | </p>
| + | |
- | </div>
| + | |
- | </li>
| + | |
- | <li>
| + | |
- | <a href="#" class="pos6">
| + | |
- | <span class="ei_preview"></span>
| + | |
- | <span class="ei_image"></span>
| + | |
- | </a>
| + | |
- | <div class="ei_descr">
| + | |
- | <h2>Matt</h2>
| + | |
- | <h3>Guitar</h3>
| + | |
- | <p>
| + | |
- | A wonderful serenity has taken possession of my
| + | |
- | entire soul, like these sweet mornings of
| + | |
- | spring which I enjoy with my whole heart.
| + | |
- | </p>
| + | |
- | <p>
| + | |
- | I am alone, and feel the charm of existence in
| + | |
- | this spot, which was created for the bliss of
| + | |
- | souls like mine.
| + | |
- | </p>
| + | |
- | </div>
| + | |
- | </li>
| + | |
- | </ul>
| + | |
- | </div>
| + | |
- | </div>
| + | |
- | <div class="footer">
| + | |
- | Tutorials and Demos by Codrops
| + | |
- | <a href="http://tympanus.net/codrops/">Home</a>|
| + | |
- | <a href="http://twitter.com/codrops">Twitter</a>|
| + | |
- | <a href="http://www.facebook.com/pages/Codrops/159107397912">Facebook</a>|
| + | |
- | <a href="http://feeds.feedburner.com/codrops">RSS</a>|
| + | |
- | <a href="http://www.flickr.com/photos/robnas/" target="_blank">Images by Robert Bejil</a> from the
| + | |
- | <a href="http://www.flickr.com/photos/robnas/sets/72157623610556961/" target="_blank"><strong>Automatic Redial 2010 Promo</strong> Set</a>
| + | |
- | </div>
| + | |
- | </div>
| + | |
- | <!-- The JavaScript -->
| + | |
- | <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
| + | |
- | <script type="text/javascript" src="js/jquery.easing.1.3.js"></script>
| + | |
- | <script type="text/javascript">
| + | |
- | $(function() {
| + | |
- | var $menu = $('#ei_menu > ul'),
| + | |
- | $menuItems = $menu.children('li'),
| + | |
- | $menuItemsImgWrapper= $menuItems.children('a'),
| + | |
- | $menuItemsPreview = $menuItemsImgWrapper.children('.ei_preview'),
| + | |
- | totalMenuItems = $menuItems.length,
| + | |
- |
| + | |
- | ExpandingMenu = (function(){
| + | |
- | /*
| + | |
- | @current
| + | |
- | set it to the index of the element you want to be opened by default,
| + | |
- | or -1 if you want the menu to be closed initially
| + | |
- | */
| + | |
- | var current = -1,
| + | |
- | /*
| + | |
- | @anim
| + | |
- | if we want the default opened item to animate initialy set this to true
| + | |
- | */
| + | |
- | anim = true,
| + | |
- | /*
| + | |
- | checks if the current value is valid -
| + | |
- | between 0 and the number of items
| + | |
- | */
| + | |
- | validCurrent = function() {
| + | |
- | return (current >= 0 && current < totalMenuItems);
| + | |
- | },
| + | |
- | init = function() {
| + | |
- | /* show default item if current is set to a valid index */
| + | |
- | if(validCurrent())
| + | |
- | configureMenu();
| + | |
| | | |
- | initEventsHandler();
| + | <style> |
- | },
| + | /* layout */ |
- | configureMenu = function() {
| + | .panorama,.panorama-view{width:100%;height:100%;overflow:hidden} |
- | /* get the item for the current */
| + | .panorama,.panorama-container{position:relative} |
- | var $item = $menuItems.eq(current);
| + | .panorama-container img{height:100%;position:absolute;top:0} |
- | /* if anim is true slide out the item */
| + | .panorama .info,.panorama-view .area{position:absolute;display:block} |
- | if(anim)
| + | .panorama .info{right:10px;bottom:10px} |
- | slideOutItem($item, true, 900, 'easeInQuint');
| + | |
- | else{
| + | |
- | /* if not just show it */
| + | |
- | $item.css({width : '400px'})
| + | |
- | .find('.ei_image')
| + | |
- | .css({left:'0px', opacity:1});
| + | |
| | | |
- | /* decrease the opacity of the others */
| + | /* style */ |
- | $menuItems.not($item)
| + | .panorama-view{cursor:url(../images/openhand.cur),default} |
- | .children('.ei_preview')
| + | .panorama-view.grab{cursor:url(../images/closedhand.cur),default} |
- | .css({opacity:0.2});
| + | .panorama .info{padding:6px;opacity:0.4;background-color:#000;color:#fff;font:11px bold Arial,sans-serif;text-decoration:none} |
- | }
| + | .panorama .info:hover{opacity:0.6} |
- | },
| + | .panorama-view .area{opacity:0.2;background-color:#000;cursor:pointer} |
- | initEventsHandler = function() {
| + | .panorama-view .area:hover{opacity:0.4} |
- | /*
| + | .panorama-view img{user-select:none;-o-user-select:none;-moz-user-select:none;-webkit-user-select:none)} |
- | when we click an item the following can happen:
| + | |
- | 1) The item is already opened - close it!
| + | |
- | 2) The item is closed - open it! (if another one is opened, close it!)
| + | |
- | */
| + | |
- | $menuItemsImgWrapper.bind('click.ExpandingMenu', function(e) {
| + | |
- | var $this = $(this).parent(),
| + | |
- | idx = $this.index();
| + | |
- | | + | |
- | if(current === idx) {
| + | |
- | slideOutItem($menuItems.eq(current), false, 1500, 'easeOutQuint', true);
| + | |
- | current = -1;
| + | |
- | }
| + | |
- | else{
| + | |
- | if(validCurrent() && current !== idx)
| + | |
- | slideOutItem($menuItems.eq(current), false, 250, 'jswing');
| + | |
- | | + | |
- | current = idx;
| + | |
- | slideOutItem($this, true, 250, 'jswing');
| + | |
- | }
| + | |
- | return false;
| + | |
- | });
| + | |
- | },
| + | |
- | /* if you want to trigger the action to open a specific item */
| + | |
- | openItem = function(idx) {
| + | |
- | $menuItemsImgWrapper.eq(idx).click();
| + | |
- | },
| + | |
- | /*
| + | |
- | opens or closes an item
| + | |
- | note that "mLeave" is just true when all the items close,
| + | |
- | in which case we want that all of them get opacity 1 again.
| + | |
- | "dir" tells us if we are opening or closing an item (true | false)
| + | |
- | */
| + | |
- | slideOutItem = function($item, dir, speed, easing, mLeave) {
| + | |
- | var $ei_image = $item.find('.ei_image'),
| + | |
- | | + | |
- | itemParam = (dir) ? {width : '400px'} : {width : '75px'},
| + | |
- | imageParam = (dir) ? {left : '0px'} : {left : '75px'};
| + | |
- | | + | |
- | /*
| + | |
- | if opening, we animate the opacity of all the elements to 0.1.
| + | |
- | this is to give focus on the opened item..
| + | |
- | */
| + | |
- | if(dir)
| + | |
- | /*
| + | |
- | alternative:
| + | |
- | $menuItemsPreview.not($menuItemsPreview.eq(current))
| + | |
- | .stop()
| + | |
- | .animate({opacity:0.1}, 500);
| + | |
- | */
| + | |
- | $menuItemsPreview.stop()
| + | |
- | .animate({opacity:0.1}, 1000);
| + | |
- | else if(mLeave)
| + | |
- | $menuItemsPreview.stop()
| + | |
- | .animate({opacity:1}, 1500);
| + | |
- | | + | |
- | /* the <li> expands or collapses */
| + | |
- | $item.stop().animate(itemParam, speed, easing);
| + | |
- | /* the image (color) slides in or out */
| + | |
- | $ei_image.stop().animate(imageParam, speed, easing, function() {
| + | |
- | /*
| + | |
- | if opening, we animate the opacity to 1,
| + | |
- | otherwise we reset it.
| + | |
- | */
| + | |
- | if(dir)
| + | |
- | $ei_image.animate({opacity:1}, 2000);
| + | |
- | else
| + | |
- | $ei_image.css('opacity', 0.2);
| + | |
- | });
| + | |
- | };
| + | |
- | | + | |
- | return {
| + | |
- | init : init,
| + | |
- | openItem : openItem
| + | |
- | };
| + | |
- | })();
| + | |
- |
| + | |
- | /*
| + | |
- | call the init method of ExpandingMenu
| + | |
- | */
| + | |
- | ExpandingMenu.init();
| + | |
- |
| + | |
- | /*
| + | |
- | if later on you want to open / close a specific item you could do it like so:
| + | |
- | ExpandingMenu.openItem(3); // toggles item 3 (zero-based indexing)
| + | |
- | */
| + | |
- | });
| + | |
- | </script>
| + | |
- | </body>
| + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | <style>
| + | |
- | body{
| + | |
- | font-family:"Trebuchet MS", sans-serif;
| + | |
- | font-size:14px;
| + | |
- | background:#333;
| + | |
- | color:#fff;
| + | |
- | }
| + | |
- | .header{
| + | |
- | text-align:center;
| + | |
- | width:100%;
| + | |
- | height:35px;
| + | |
- | clear:both;
| + | |
- | background:#000 url(../images/stripe.gif) repeat top left;
| + | |
- | margin-bottom:20px;
| + | |
- | border-bottom:7px solid #222;
| + | |
- | font-size:11px;
| + | |
- | line-height:35px;
| + | |
- | font-style:italic;
| + | |
- | text-shadow:1px 1px 1px #000;
| + | |
- | }
| + | |
- | .header a{
| + | |
- | color:#aaa;
| + | |
- | text-shadow:1px 1px 1px #000;
| + | |
- | padding-right:20px;
| + | |
- | }
| + | |
- | .header a:hover{
| + | |
- | color:#fff;
| + | |
- | }
| + | |
- | .container {
| + | |
- | position:relative; /* needed for footer positioning*/
| + | |
- | margin:0 auto; /* center, not in IE5 */
| + | |
- | width:100%;
| + | |
- | height:auto !important; /* real browsers */
| + | |
- | height:100%; /* IE6: treaded as min-height*/
| + | |
- | min-height:100%; /* real browsers */
| + | |
- | }
| + | |
- | .left{
| + | |
- | float:left;
| + | |
- | margin-left:10px;
| + | |
- | }
| + | |
- | .back{
| + | |
- | position:absolute;
| + | |
- | right:10px;
| + | |
- | top:0px;
| + | |
- | }
| + | |
- | .content > h1{
| + | |
- | font-size:40px;
| + | |
- | font-weight:normal;
| + | |
- | text-shadow:0px 0px 1px #fff;
| + | |
- | font-family: 'Raleway', arial, serif;
| + | |
- | border-bottom:1px dotted #444;
| + | |
- | padding:10px 20px;
| + | |
- | }
| + | |
- | .content > h3{
| + | |
- | font-size:24px;
| + | |
- | color:#aaa;
| + | |
- | font-weight:normal;
| + | |
- | padding:10px 20px;
| + | |
- | text-shadow:1px 1px 1px #000;
| + | |
- | font-family: 'Rock Salt', arial, serif;
| + | |
- | }
| + | |
- | h3 a{
| + | |
- | font-size:14px;
| + | |
- | padding-left:20px;
| + | |
- | }
| + | |
- | a{
| + | |
- | color:#777;
| + | |
- | text-decoration:none;
| + | |
- | }
| + | |
- | a:hover{
| + | |
- | color:#fff;
| + | |
- | } | + | |
- | .content { | + | |
- | margin:0 auto;
| + | |
- | padding:0px 0px 58px 0px; /* Footer Padding */
| + | |
- | }
| + | |
- | .footer { | + | |
- | position:absolute;
| + | |
- | width:100%;
| + | |
- | height:50px;
| + | |
- | line-height:50px;
| + | |
- | bottom:0; /* stick to bottom */
| + | |
- | background:#f0f0f0;
| + | |
- | border-top:7px solid #222;
| + | |
- | text-align:center;
| + | |
- | text-shadow:1px 1px 1px #000;
| + | |
- | color:#fff;
| + | |
- | background:#000 url(../images/stripe.gif) repeat top left;
| + | |
- | }
| + | |
- | .footer a{
| + | |
- | color:#aaa;
| + | |
- | padding:0px 10px;
| + | |
- | text-shadow:1px 1px 1px #000;
| + | |
- | }
| + | |
- | .footer a:hover{
| + | |
- | color:#fff;
| + | |
- | text-shadow:0px 0px 1px #fff;
| + | |
- | }
| + | |
- | /* Menu style */
| + | |
- | .ei_menu{ | + | |
- | background:#111;
| + | |
- | width:100%;
| + | |
- | overflow:hidden;
| + | |
- | } | + | |
- | .ei_menu ul{ | + | |
- | height:350px;
| + | |
- | margin-left:50px;
| + | |
- | position:relative;
| + | |
- | display:block;
| + | |
- | width:1300px;
| + | |
- | }
| + | |
- | .ei_menu ul li{ | + | |
- | float:left;
| + | |
- | width:75px;
| + | |
- | height:350px;
| + | |
- | position:relative;
| + | |
- | overflow:hidden;
| + | |
- | border-right:2px solid #111;
| + | |
- | }
| + | |
- | .ei_preview{
| + | |
- | width:75px;
| + | |
- | height:350px;
| + | |
- | cursor:pointer;
| + | |
- | position:absolute;
| + | |
- | top:0px;
| + | |
- | left:0px;
| + | |
- | background:transparent url(https://static.igem.org/mediawiki/2011/a/a6/Header.png) no-repeat top left;
| + | |
- | }
| + | |
- | .ei_image{
| + | |
- | position:absolute;
| + | |
- | left:75px;
| + | |
- | top:0px;
| + | |
- | width:75px;
| + | |
- | height:350px;
| + | |
- | opacity:0.2;
| + | |
- | background:transparent url(https://static.igem.org/mediawiki/2011/b/b0/RingUp.png) no-repeat top left;
| + | |
- | }
| + | |
- | .pos1 span{
| + | |
- | background-position:0px 0px;
| + | |
- | }
| + | |
- | .pos2 span{
| + | |
- | background-position:-75px 0px;
| + | |
- | } | + | |
- | .pos3 span{ | + | |
- | background-position:-152px 0px;
| + | |
- | }
| + | |
- | .pos4 span{ | + | |
- | background-position:-227px 0px;
| + | |
- | }
| + | |
- | .pos5 span{
| + | |
- | background-position:-302px 0px;
| + | |
- | }
| + | |
- | .pos6 span{ | + | |
- | background-position:-377px 0px;
| + | |
- | } | + | |
- | .ei_descr{ | + | |
- | position:absolute;
| + | |
- | width:278px;
| + | |
- | height:310px;
| + | |
- | border-right:7px solid #f0f0f0;
| + | |
- | padding:20px;
| + | |
- | left:75px;
| + | |
- | top:0px;
| + | |
- | background:#fff;
| + | |
- | }
| + | |
- | .ei_descr h2{
| + | |
- | font-family: 'Rock Salt', arial, serif;
| + | |
- | font-size:26px;
| + | |
- | color:#333;
| + | |
- | padding:10px;
| + | |
- | text-shadow:0px 0px 1px #fff;
| + | |
- | background:#fff url(../images/stripe_light.gif) repeat top left;
| + | |
- | }
| + | |
- | .ei_descr h3{
| + | |
- | font-family: 'Raleway', arial, serif;
| + | |
- | color:#fff;
| + | |
- | text-shadow:0px 0px 1px #000;
| + | |
- | font-style:normal;
| + | |
- | padding:10px;
| + | |
- | background:#333;
| + | |
- | }
| + | |
- | .ei_descr p{
| + | |
- | color:#000;
| + | |
- | padding:10px 5px 0px 5px;
| + | |
- | line-height:18px;
| + | |
- | font-size:11px;
| + | |
- | font-family: Arial;
| + | |
- | text-transform:uppercase;
| + | |
- | }
| + | |
- | | + | |
- | /* For the index_3 demo */
| + | |
- | ul.trigger_list{
| + | |
- | position:absolute;
| + | |
- | right:20px;
| + | |
- | top:145px;
| + | |
- | }
| + | |
- | ul.trigger_list li{
| + | |
- | float:left;
| + | |
- | line-height:53px;
| + | |
- | color:#ddd;
| + | |
- | font-style:italic;
| + | |
- | }
| + | |
- | ul.trigger_list li a{
| + | |
- | font-family: 'Rock Salt', arial, serif;
| + | |
- | display:block;
| + | |
- | background:#000;
| + | |
- | color:#ddd;
| + | |
- | line-height:35px;
| + | |
- | padding:5px 10px;
| + | |
- | margin:3px;
| + | |
- | border-radius:5px 5px 5px 5px;
| + | |
- | text-shadow:1px 1px 1px #000;
| + | |
- | }
| + | |
- | ul.trigger_list li a:hover{
| + | |
- | background:#222;
| + | |
- | color:#fff;
| + | |
- | | + | |
- | } | + | |
| </style> | | </style> |
| + | <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script> |
| + | <!-- <script src="js/jquery.mousewheel.min.js"></script> |
| + | <script src="js/jquery.panorama360.js"></script> --> |
| + | |
| + | <script src="https://sites.google.com/site/bobstringfiles/arcanum/jquery.mousewheel.min.js"></script> |
| + | <script src="https://sites.google.com/site/bobstringfiles/arcanum/jquery.panorama360.js"></script> |
| + | <script> |
| + | |
| + | $(function(){ |
| + | $('.panorama-view').panorama360(); |
| + | }); |
| | | |
- | | + | </script> |
- | | + | </head> |
- | <script type="text/javascript"> | + | <body> |
- | | + | <div class="panorama round" style="position:absolute;width:700px;height:500px;padding:10px;top:50%;left:50%;margin-top:-260px;margin-left:-360px;background-color:#444;"> |
- | /* | + | <div class="panorama-view"> |
- | * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
| + | <div class="panorama-container"> |
- | *
| + | <img src="https://sites.google.com/site/bobstringfiles/arcanum/arcanumlab.jpg" data-width="7476" data-height="501" alt="Panorama" /> |
- | * Uses the built in easing capabilities added In jQuery 1.1
| + | </div> |
- | * to offer multiple easing options
| + | </div> |
- | *
| + | <a class="info round" href="http://www.arcanumproject.com">Arcanum Lab</a> |
- | * TERMS OF USE - jQuery Easing
| + | </div> |
- | *
| + | </body> |
- | * Open source under the BSD License.
| + | |
- | *
| + | |
- | * Copyright © 2008 George McGinley Smith
| + | |
- | * All rights reserved.
| + | |
- | *
| + | |
- | * Redistribution and use in source and binary forms, with or without modification,
| + | |
- | * are permitted provided that the following conditions are met:
| + | |
- | *
| + | |
- | * Redistributions of source code must retain the above copyright notice, this list of
| + | |
- | * conditions and the following disclaimer.
| + | |
- | * Redistributions in binary form must reproduce the above copyright notice, this list
| + | |
- | * of conditions and the following disclaimer in the documentation and/or other materials
| + | |
- | * provided with the distribution.
| + | |
- | *
| + | |
- | * Neither the name of the author nor the names of contributors may be used to endorse
| + | |
- | * or promote products derived from this software without specific prior written permission.
| + | |
- | *
| + | |
- | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
| + | |
- | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
| + | |
- | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
| + | |
- | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
| + | |
- | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
| + | |
- | * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
| + | |
- | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
| + | |
- | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
| + | |
- | * OF THE POSSIBILITY OF SUCH DAMAGE.
| + | |
- | *
| + | |
- | */
| + | |
- | | + | |
- | // t: current time, b: begInnIng value, c: change In value, d: duration
| + | |
- | jQuery.easing['jswing'] = jQuery.easing['swing'];
| + | |
- | | + | |
- | jQuery.extend( jQuery.easing,
| + | |
- | {
| + | |
- | def: 'easeOutQuad', | + | |
- | swing: function (x, t, b, c, d) {
| + | |
- | //alert(jQuery.easing.default);
| + | |
- | return jQuery.easing[jQuery.easing.def](x, t, b, c, d);
| + | |
- | },
| + | |
- | easeInQuad: function (x, t, b, c, d) {
| + | |
- | return c*(t/=d)*t + b;
| + | |
- | },
| + | |
- | easeOutQuad: function (x, t, b, c, d) {
| + | |
- | return -c *(t/=d)*(t-2) + b;
| + | |
- | },
| + | |
- | easeInOutQuad: function (x, t, b, c, d) {
| + | |
- | if ((t/=d/2) < 1) return c/2*t*t + b;
| + | |
- | return -c/2 * ((--t)*(t-2) - 1) + b;
| + | |
- | },
| + | |
- | easeInCubic: function (x, t, b, c, d) {
| + | |
- | return c*(t/=d)*t*t + b;
| + | |
- | },
| + | |
- | easeOutCubic: function (x, t, b, c, d) {
| + | |
- | return c*((t=t/d-1)*t*t + 1) + b;
| + | |
- | },
| + | |
- | easeInOutCubic: function (x, t, b, c, d) {
| + | |
- | if ((t/=d/2) < 1) return c/2*t*t*t + b;
| + | |
- | return c/2*((t-=2)*t*t + 2) + b;
| + | |
- | },
| + | |
- | easeInQuart: function (x, t, b, c, d) {
| + | |
- | return c*(t/=d)*t*t*t + b;
| + | |
- | },
| + | |
- | easeOutQuart: function (x, t, b, c, d) {
| + | |
- | return -c * ((t=t/d-1)*t*t*t - 1) + b;
| + | |
- | },
| + | |
- | easeInOutQuart: function (x, t, b, c, d) {
| + | |
- | if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
| + | |
- | return -c/2 * ((t-=2)*t*t*t - 2) + b;
| + | |
- | },
| + | |
- | easeInQuint: function (x, t, b, c, d) {
| + | |
- | return c*(t/=d)*t*t*t*t + b;
| + | |
- | },
| + | |
- | easeOutQuint: function (x, t, b, c, d) {
| + | |
- | return c*((t=t/d-1)*t*t*t*t + 1) + b;
| + | |
- | },
| + | |
- | easeInOutQuint: function (x, t, b, c, d) {
| + | |
- | if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
| + | |
- | return c/2*((t-=2)*t*t*t*t + 2) + b;
| + | |
- | },
| + | |
- | easeInSine: function (x, t, b, c, d) {
| + | |
- | return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
| + | |
- | },
| + | |
- | easeOutSine: function (x, t, b, c, d) {
| + | |
- | return c * Math.sin(t/d * (Math.PI/2)) + b;
| + | |
- | },
| + | |
- | easeInOutSine: function (x, t, b, c, d) {
| + | |
- | return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
| + | |
- | },
| + | |
- | easeInExpo: function (x, t, b, c, d) {
| + | |
- | return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
| + | |
- | },
| + | |
- | easeOutExpo: function (x, t, b, c, d) {
| + | |
- | return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
| + | |
- | },
| + | |
- | easeInOutExpo: function (x, t, b, c, d) {
| + | |
- | if (t==0) return b;
| + | |
- | if (t==d) return b+c; | + | |
- | if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
| + | |
- | return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
| + | |
- | },
| + | |
- | easeInCirc: function (x, t, b, c, d) {
| + | |
- | return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
| + | |
- | },
| + | |
- | easeOutCirc: function (x, t, b, c, d) {
| + | |
- | return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
| + | |
- | },
| + | |
- | easeInOutCirc: function (x, t, b, c, d) {
| + | |
- | if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
| + | |
- | return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
| + | |
- | },
| + | |
- | easeInElastic: function (x, t, b, c, d) {
| + | |
- | var s=1.70158;var p=0;var a=c;
| + | |
- | if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
| + | |
- | if (a < Math.abs(c)) { a=c; var s=p/4; }
| + | |
- | else var s = p/(2*Math.PI) * Math.asin (c/a);
| + | |
- | return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
| + | |
- | },
| + | |
- | easeOutElastic: function (x, t, b, c, d) {
| + | |
- | var s=1.70158;var p=0;var a=c;
| + | |
- | if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
| + | |
- | if (a < Math.abs(c)) { a=c; var s=p/4; }
| + | |
- | else var s = p/(2*Math.PI) * Math.asin (c/a); | + | |
- | return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
| + | |
- | },
| + | |
- | easeInOutElastic: function (x, t, b, c, d) {
| + | |
- | var s=1.70158;var p=0;var a=c;
| + | |
- | if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5);
| + | |
- | if (a < Math.abs(c)) { a=c; var s=p/4; }
| + | |
- | else var s = p/(2*Math.PI) * Math.asin (c/a); | + | |
- | if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
| + | |
- | return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
| + | |
- | },
| + | |
- | easeInBack: function (x, t, b, c, d, s) {
| + | |
- | if (s == undefined) s = 1.70158;
| + | |
- | return c*(t/=d)*t*((s+1)*t - s) + b;
| + | |
- | },
| + | |
- | easeOutBack: function (x, t, b, c, d, s) {
| + | |
- | if (s == undefined) s = 1.70158;
| + | |
- | return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
| + | |
- | },
| + | |
- | easeInOutBack: function (x, t, b, c, d, s) {
| + | |
- | if (s == undefined) s = 1.70158;
| + | |
- | if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
| + | |
- | return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
| + | |
- | },
| + | |
- | easeInBounce: function (x, t, b, c, d) {
| + | |
- | return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b;
| + | |
- | },
| + | |
- | easeOutBounce: function (x, t, b, c, d) {
| + | |
- | if ((t/=d) < (1/2.75)) {
| + | |
- | return c*(7.5625*t*t) + b;
| + | |
- | } else if (t < (2/2.75)) {
| + | |
- | return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
| + | |
- | } else if (t < (2.5/2.75)) {
| + | |
- | return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
| + | |
- | } else {
| + | |
- | return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
| + | |
- | }
| + | |
- | }, | + | |
- | easeInOutBounce: function (x, t, b, c, d) {
| + | |
- | if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
| + | |
- | return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
| + | |
- | }
| + | |
- | });
| + | |
- | | + | |
- | /*
| + | |
- | *
| + | |
- | * TERMS OF USE - EASING EQUATIONS
| + | |
- | *
| + | |
- | * Open source under the BSD License.
| + | |
- | *
| + | |
- | * Copyright © 2001 Robert Penner
| + | |
- | * All rights reserved.
| + | |
- | *
| + | |
- | * Redistribution and use in source and binary forms, with or without modification,
| + | |
- | * are permitted provided that the following conditions are met:
| + | |
- | *
| + | |
- | * Redistributions of source code must retain the above copyright notice, this list of
| + | |
- | * conditions and the following disclaimer.
| + | |
- | * Redistributions in binary form must reproduce the above copyright notice, this list
| + | |
- | * of conditions and the following disclaimer in the documentation and/or other materials
| + | |
- | * provided with the distribution.
| + | |
- | *
| + | |
- | * Neither the name of the author nor the names of contributors may be used to endorse
| + | |
- | * or promote products derived from this software without specific prior written permission.
| + | |
- | *
| + | |
- | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
| + | |
- | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
| + | |
- | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
| + | |
- | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
| + | |
- | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
| + | |
- | * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
| + | |
- | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
| + | |
- | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
| + | |
- | * OF THE POSSIBILITY OF SUCH DAMAGE.
| + | |
- | *
| + | |
- | */
| + | |
- | </script> | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
- | | + | |
| </html> | | </html> |