现在我们能看到的网站各式各样、稀奇古怪,网站也不再局限于标准宽度,长度的设置。国外很多页面都使用了在一个页面里实现横向和纵向的页面跳转,其不为网页设计的新的领域。 Step1. 创建HTML <div class="section black" id="section1"> <h2>Page 1</h2> <p> This is page one, I am a freelance web designer & graphic designer based in Shanghai, CN. I make Green Environment Protection website, accessible websites that are easy to use and easy for our life. </p> <p class="link">Welcome to <a href="http://www.sunflowamedia.com/" target="_blank">Sunflowa Media Website</a></p> <p class="link">Link to the <a href="index_vertical.html">index_vertical.html</a></p> <ul class="nav"> <li>1</li> <li><a href="#section2">2</a></li> <li><a href="#section3">3</a></li> </ul> </div> <div class="section white" id="section2"> <h2>Page 2</h2> <p> This is page two, I am a freelance web designer & graphic designer based in Shanghai, CN. I make Green Environment Protection website, accessible websites that are easy to use and easy for our life. </p> <p class="link">Welcome to <a href="http://www.sunflowamedia.com/" target="_blank">Sunflowa Media Website</a></p> <p class="link">Link to the <a href="index_vertical.html">index_vertical.html</a></p> <ul class="nav"> <li><a href="#section1">1</a></li> <li>2</li> <li><a href="#section3">3</a></li> </ul> </div> <div class="section yellow" id="section3"> <h2>Page 3</h2> <p> This is page three, I am a freelance web designer & graphic designer based in Shanghai, CN. I make Green Environment Protection website, accessible websites that are easy to use and easy for our life. </p> <p class="link">Welcome to <a href="http://www.sunflowamedia.com/" target="_blank">Sunflowa Media Website</a></p> <p class="link">Link to the <a href="index_vertical.html">index_vertical.html</a></p> <ul class="nav"> <li><a href="#section1">1</a></li> <li><a href="#section2">2</a></li> <li>3</li> </ul> </div> Step2. 创建CSS 横向: Step3. 插入jQuery和脚本包 <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> <script type="text/javascript" src="js/jquery.easing.1.3.js"></script> 脚本: $(function() {
$('ul.nav a').bind('click',function(event){
var $anchor = $(this);
/*
$('html, body').stop().animate({
scrollTop: $($anchor.attr('href')).offset().top
}, 1500,'easeInOutExpo');
*/ 纵向代码,替换下面
$('html, body').stop().animate({
scrollLeft: $($anchor.attr('href')).offset().left
}, 1000);
event.preventDefault();
});
});
(责任编辑:admin) |