SwipeNav 手势插件导航
XML/HTML Code
- <nav id="swipeNav">
- <ul>
- <li><a href="" target="_blank">Download</a></li>
- <li><a href="" target="_blank">Author</a></li>
- <li><a href="license.html">License</a></li>
- <li><a href="source.html">SourceCode</a></li>
- </ul>
- </nav>
- <div id="container">
- <img src="img/list-icon.png" alt="" width="24" height="24" id="menuBtn" />
- <h1>jQuery Plugin SwipeNav</h1>
- <div id="main"></div><!-- /#main -->
- </div><!-- /#container -->
JavaScript Code
- <script type="text/javascript">
- jQuery(document).ready(function($){
- //Google Font
- WebFontConfig = {
- google: { families: [ 'Raleway::latin' ] }
- };
- (function() {
- var wf = document.createElement('script');
- wf.src = 'https://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js';
- wf.type = 'text/javascript';
- wf.async = 'true';
- var s = document.getElementsByTagName('script')[0];
- s.parentNode.insertBefore(wf, s);
- })();
- //Page Action
- $(document).on('click','#swipeNav li a',function(){
- var href= $(this).attr("href");
- switch(href){
- case '#license':
- $('#main').load('license.html');
- return false;
- break;
- case '#src':
- $('#main').load('src.html');
- return false;
- break;
- }
- });
- //jQueryPlug-in Slide-Nav
- $('#swipeNav').swipeNav();
- });
- </script>
原文地址:http://www.freejs.net/article_daohangcaidan_728.html