Last active
December 19, 2015 23:49
-
-
Save umidjons/6037013 to your computer and use it in GitHub Desktop.
Cycle Slider Test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <html> | |
| <head> | |
| <title>Test</title> | |
| <style> | |
| html,body{ | |
| width: 100%; | |
| height: 100%; | |
| margin: 0; | |
| padding: 0; | |
| } | |
| .container{ | |
| width: 100%; | |
| height: 100%; | |
| } | |
| #nav{ | |
| position: absolute; | |
| z-index: 999; | |
| text-align: center; | |
| width: 100%; | |
| background: #000; | |
| top: 10px; | |
| } | |
| #nav a{ | |
| display: inline-block; | |
| padding: 10px 15px; | |
| color: #fff; | |
| text-decoration: none; | |
| } | |
| #nav a:hover, #nav a.activeSlide{ | |
| border-bottom: 3px solid #FFB128; | |
| } | |
| </style> | |
| <script src="js/jquery.min.js"></script> | |
| <script src="js/jquery.cycle.all.js"></script> | |
| </head> | |
| <body> | |
| <div id="nav"></div> | |
| <div id="container" class="container"> | |
| <img src="images/bg1.jpg"> | |
| <img src="images/bg2.jpg"> | |
| <img src="images/bg3.jpg"> | |
| <img src="images/bg4.jpg"> | |
| <img src="images/bg5.jpg"> | |
| </div> | |
| <script> | |
| jQuery( document ).ready( function( $ ) { | |
| var menuItems = [ 'UniMotion', 'UniAction', 'UniGames', 'UniSound', 'UniColor' ]; | |
| $( '#container' ) | |
| .cycle( { | |
| fx: 'scrollLeft', | |
| speed: 'fast', | |
| timeout: 0, | |
| pager: '#nav', | |
| pagerAnchorBuilder: function( index ) { | |
| return '<a href="#">' + menuItems[index] + '</a>'; | |
| }, | |
| } ); | |
| } ); | |
| </script> | |
| </body> | |
| </html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| jQuery( document ).ready( function ( $ ) { | |
| // for bookmarkable slide | |
| var index = 0, hash = window.location.hash; | |
| if ( hash ) { | |
| index = /\d+/.exec( hash )[0]; | |
| index = (parseInt( index ) || 1) - 1; // slides are zero-based | |
| } | |
| // make sliding pages | |
| // navigation menu items text | |
| var menuItems = [ 'Home', 'UniMotion', 'UniAction', 'UniGames', 'UniSound', 'UniColor' ]; | |
| $( '#container' ) | |
| .cycle( { | |
| fx : 'scrollHorz', // scrollHorz supports both side sliding | |
| speed : 'slow', | |
| timeout : 0, // 0-manually slide (with navigation controls) | |
| pager : '#nav', // id of the navigation element | |
| startingSlide : index, // for bookmarkable slide | |
| pagerAnchorBuilder: function ( index ) { // build navigation links with custom titles | |
| return '<a href="#">' + menuItems[index] + '</a>'; | |
| }, | |
| after : function ( curr, next, opts ) { // for bookmarkable slide | |
| window.location.hash = opts.currSlide + 1; | |
| } | |
| } ); | |
| // slide to home page, index=0 | |
| $( '.home-link' ).click( function ( __event ) { | |
| $( '#container' ).cycle( 0 ); | |
| return false; | |
| } ); | |
| } ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment