所以我在这里使用这个演示插件http://tympanus.net/Tutorials/PrettySimpleContentSlider/并试图让右侧的动画标签(ul id="rotmenu")能够自由浮动并自由定位在其主要的 div 类“旋转器”之外,仍然保持其功能并在旋转器中发挥作用。我尝试在这里和那里对 div 和类的属性进行一些简单的更改,但它们或多或少地把事情搞砸了。有任何想法吗?
好的,这里是使用 jquery_easing.1.3 和 jquery.min.js 库的 js
<script type="text/javascript">
$(function() {
var current = 1;
var iterate = function(){
var i = parseInt(current+1);
var lis = $('#rotmenu').children('li').size();
}
display($('#rotmenu li:first'));
var slidetime = setInterval(iterate,3000);
$('#rotmenu li').bind('click',function(e){
clearTimeout(slidetime);
display($(this));
e.preventDefault();
});
function display(elem){
var $this = elem;
var repeat = false;
if(current == parseInt($this.index() + 1))
repeat = true;
if(!repeat)
$this.parent().find('li:nth-child('+current+') a').stop(true,true).animate({'marginRight':'-20px'},300,function(){
$(this).animate({'opacity':'0.7'},700);
});
current = parseInt($this.index() + 1);
var elem = $('a',$this);
elem.stop(true,true).animate({'marginRight':'0px','opacity':'1.0'},300);
var info_elem = elem.next();
$('#rot1 .heading').animate({'left':'-420px'}, 500,'easeOutCirc',function(){
$('h1',$(this)).html(info_elem.find('.info_heading').html());
$(this).animate({'left':'0px'},400,'easeInOutQuad');
});
$('#rot1 .description').animate({'bottom':'-270px'},500,'easeOutCirc',function(){
$('p',$(this)).html(info_elem.find('.info_description').html());
$(this).animate({'bottom':'0px'},400,'easeInOutQuad');
})
$('#rot1').prepend(
$('<img/>',{
style : 'opacity:0',
className : 'bg'
}).load(
function(){
$(this).animate({'opacity':'1'},600);
$('#rot1 img:first').next().animate({'opacity':'0'},700,function(){
$(this).remove();
});
}
).attr('src','images/'+info_elem.find('.info_image').html()).attr('width','800').attr('height','300')
);
}
});
</script>
应用 jquery 的地方
<body>
<div id="content">
<a class="back" href=""></a>
<div class="rotator">
<ul id="rotmenu">
<li>
<a href="rot1">Portfolio</a>
<div style="display:none;">
<div class="info_image">1.jpg</div>
<div class="info_heading">Our Works</div>
<div class="info_description">
<a href="#" class="more">Read more</a>
</div>
</div>
</li>
<li>
<a href="rot2">Services</a>
<div style="display:none;">
<div class="info_image">2.jpg</div>
<div class="info_heading">We serve</div>
<div class="info_description">
<a href="#" class="more">Read more</a>
</div>
</div>
</li>
<li>
<a href="rot3">Contact</a>
<div style="display:none;">
<div class="info_image">3.jpg</div>
<div class="info_heading">Get in touch</div>
<div class="info_description">
<a href="#" class="more">Read more</a>
</div>
</div>
</li>
<li>
<a href="rot4">Experiments</a>
<div style="display:none;">
<div class="info_image">4.jpg</div>
<div class="info_heading">We do crazy stuff</div>
<div class="info_description">
<a href="#" class="more">Read more</a>
</div>
</div>
</li>
<li>
<a href="rot5">Applications</a>
<div style="display:none;">
<div class="info_image">5.jpg</div>
<div class="info_heading">Working things</div>
<div class="info_description">
<a href="#" class="more">Read more</a>
</div>
</div>
</li>
</ul>
<div id="rot1">
<img src="" width="800" height="300" class="bg" alt=""/>
<div class="heading">
<h1></h1>
</div>
<div class="description">
<p></p>
</div>
</div>
</div>
</div>