我正在尝试使用jQuery使我的网站水平滑动,但是我对jQuery的了解非常有限,我想知道是否有人能告诉我我是否正沿着正确的轨道前进! 我在每个阶段评论了我想要代码做什么,这是我的代码......
$(document).ready(function() {
var totalSections = $('section').length;
// get width of viewport
var viewportWidth = $(window).width();
// set a number to be zero
var total = 0;
// start looping through sections
$('section').each(function() {
// set a variable to be width multiplied by total
var leftValues = (viewportWidth * total);
// set current section to have the width of the value of variable 'leftValues'
$(this).css("width" , //I can't finish this line?
//add 1 to total
$('section').each(function() {
var newTotal = (total + 1);
});
});
到目前为止,我不知道我的代码是否正确! 非常感谢你提前!