http://cambridgeuplighting.com/portfolio
我正在尝试创建一个函数,当幻灯片到达任一端时,该函数将淡出 scrollTo 函数的 Next 和 Prev 控件。我有一个好的开始,但它并没有按照我想要的方式工作。我需要控件在点击结束之前淡出点击。现在它到达末尾,然后下一次单击(不会滚动,因为它在末尾)将使控件淡出。
这是我的代码,提前非常感谢!
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 );
}
});
});