http://cambridgeuplighting.com/portfolioUI修改jQuery的scrollTo:没事的时候再进行滚动
我试图创建将褪色的下一步和上一个scrollTo功能控制功能,当幻灯片已经到达最终淡出上一页/下一页控制。我有一个好的开始,但它不工作,我想要它。我需要这些控件在达到最后才淡出点击。现在它到达最后,然后下一次单击(不会滚动,因为它在最后)会淡化控件。
这里很多是我的代码,在此先感谢!
的jQuery(请参阅上面的链接到该网站的HTML和CSS)
jQuery(function($){
var itemSize = $('div.portfolioPost').size();
var containerWidth = itemSize*240;
//set the width of the container depending on how many post items are there
$('#postContainer').css({'width': containerWidth })
//find the relative position of the end point by getting the negative value of the container width minus 961 (extra pixel is to account for IE difference)
var endPoint = 0-containerWidth+961;
$('.olderEvents').click(function() {
$('.newerEvents').fadeTo(350, 1.0)
var slidePos = $('#postContainer').position();
if (slidePos.left<=endPoint) {
$('.olderEvents').fadeTo(350, 0.1)
} else {
$('#slideScreen').scrollTo('+=960', 700);
}
});
$('.newerEvents').click(function() {
$('.olderEvents').fadeTo(350, 1.0)
var slidePos = $('#postContainer').position();
//relative position of 0 means the slideshow is at the other end
if (slidePos.left==0) {
$('.newerEvents').fadeTo(350, 0.1)
} else {
$('#slideScreen').scrollTo('-=960', 700);
}
});
});