<script>
$(document).ready(function() {
// Code to bring each link on to screen and in position
$("#link1").animate({
left: '30px',
top: '5px'
}, 1000);
$("#link2").animate({
left: '80px',
top: '5px'
}, 1400);
$("#link3").animate({
left: '130px',
top: '5px'
}, 1400);
$("#link4").animate({
left: '180px',
top: '5px'
}, 1600);
$("#link5").animate({
left: '230px',
top: '5px'
}, 1800);
// Fade in & out on hover
$("#link1").hover(function() {
$(this).fadeOut(150);
$(this).fadeIn(150);
});
// Fade in & out on hover
$("#link2").hover(function() {
$(this).fadeOut(150);
$(this).fadeIn(150);
});
// Fade in & out on hover
$("#link3").hover(function() {
$(this).fadeOut(150);
$(this).fadeIn(150);
});
// Fade in & out on hover
$("#link4").hover(function() {
$(this).fadeOut(150);
$(this).fadeIn(150);
});
// Fade in & out on hover
$("#link5").hover(function() {
$(this).fadeOut(150);
$(this).fadeIn(150);
});
// Nudge the link when "clicked"
$("#link1").mousedown(function() {
$(this).css("padding-top", "5px");
});
$("#link1").mouseup(function() {
$(this).css("padding-top", "0px");
});
// Nudge the link when "clicked"
$("#link2").mousedown(function() {
$(this).css("padding-top", "5px");
});
$("#link2").mouseup(function() {
$(this).css("padding-top", "0px");
});
// Nudge the link when "clicked"
$("#link3").mousedown(function() {
$(this).css("padding-top", "5px");
});
$("#link3").mouseup(function() {
$(this).css("padding-top", "0px");
});
// Nudge the link when "clicked"
$("#link4").mousedown(function() {
$(this).css("padding-top", "5px");
});
$("#link4").mouseup(function() {
$(this).css("padding-top", "0px");
});
// Nudge the link when "clicked"
$("#link5").mousedown(function() {
$(this).css("padding-top", "5px");
});
$("#link5").mouseup(function() {
$(this).css("padding-top", "0px");
});
// Parallax Scroll
$(window).bind('scroll', function (e) {
parallaxScroll();
});
function parallaxScroll() {
var scrolledY = $(window).scrollTop();
$('#bblogo1').css('top', '-' + ((scrolledY * 0.6)) + 'px');
$('#bblogo2').css('top', '-' + ((scrolledY * 0.5)) + 'px');
$('#bblogo3').css('top', '-' + ((scrolledY * 0.3)) + 'px');
$('#bblogo4').css('top', '-' + ((scrolledY * 0.9)) + 'px');
$('#bblogo5').css('top', '-' + ((scrolledY * 0.6)) + 'px');
$('#bblogo6').css('top', '-' + ((scrolledY * 0.1)) + 'px');
$('#bblogo7').css('top', '-' + ((scrolledY * 0.4)) + 'px');
$('#bbspinner').animate(function(){
$(this).css
("background","url(images/bblogorender0000.png)");
});
});
</script>
1
A
回答
1
这一个你缺少更换你的代码右括号
$(document).ready(function()
// Code to bring each link on to screen and in position
{ $("#link1").animate({
left: '30px',
top: '5px'
}, 1000);
$("#link2").animate({
left: '80px',
top: '5px'
}, 1400);
$("#link3").animate({
left: '130px',
top: '5px'
}, 1400);
$("#link4").animate({
left: '180px',
top: '5px'
}, 1600);
$("#link5").animate({
left: '230px',
top: '5px'
}, 1800);
// Fade in & out on hover
$("#link1").hover(function() {
$(this).fadeOut(150);
$(this).fadeIn(150);
});
// Fade in & out on hover
$("#link2").hover(function() {
$(this).fadeOut(150);
$(this).fadeIn(150);
});
// Fade in & out on hover
$("#link3").hover(function() {
$(this).fadeOut(150);
$(this).fadeIn(150);
});
// Fade in & out on hover
$("#link4").hover(function() {
$(this).fadeOut(150);
$(this).fadeIn(150);
});
// Fade in & out on hover
$("#link5").hover(function() {
$(this).fadeOut(150);
$(this).fadeIn(150);
});
// Nudge the link when "clicked"
$("#link1").mousedown(function() {
$(this).css("padding-top", "5px");
});
$("#link1").mouseup(function() {
$(this).css("padding-top", "0px");
});
// Nudge the link when "clicked"
$("#link2").mousedown(function() {
$(this).css("padding-top", "5px");
});
$("#link2").mouseup(function() {
$(this).css("padding-top", "0px");
});
// Nudge the link when "clicked"
$("#link3").mousedown(function() {
$(this).css("padding-top", "5px");
});
$("#link3").mouseup(function() {
$(this).css("padding-top", "0px");
});
// Nudge the link when "clicked"
$("#link4").mousedown(function() {
$(this).css("padding-top", "5px");
});
$("#link4").mouseup(function() {
$(this).css("padding-top", "0px");
});
// Nudge the link when "clicked"
$("#link5").mousedown(function() {
$(this).css("padding-top", "5px");
});
$("#link5").mouseup(function() {
$(this).css("padding-top", "0px");
});
// Parallax Scroll
$(window).bind('scroll', function (e) {
parallaxScroll();
});
function parallaxScroll() {
var scrolledY = $(window).scrollTop();
$('#bblogo1').css('top', '-' + ((scrolledY * 0.6)) + 'px');
$('#bblogo2').css('top', '-' + ((scrolledY * 0.5)) + 'px');
$('#bblogo3').css('top', '-' + ((scrolledY * 0.3)) + 'px');
$('#bblogo4').css('top', '-' + ((scrolledY * 0.9)) + 'px');
$('#bblogo5').css('top', '-' + ((scrolledY * 0.6)) + 'px');
$('#bblogo6').css('top', '-' + ((scrolledY * 0.1)) + 'px');
$('#bblogo7').css('top', '-' + ((scrolledY * 0.4)) + 'px');
$('#bbspinner').animate(function(){
$(this).css
("background","url(images/bblogorender0000.png)");
});
}
});
您可以检查这里http://jsfiddle.net/
2
就在年底,在parallaxScroll
底部,则需要前});
你有没有把一个}
。该});
关闭文档ready
叫你开始在开始的时候,所以你需要它,但你需要首先关闭parallaxScroll
功能:
function parallaxScroll() {
var scrolledY = $(window).scrollTop();
$('#bblogo1').css('top', '-' + ((scrolledY * 0.6)) + 'px');
$('#bblogo2').css('top', '-' + ((scrolledY * 0.5)) + 'px');
$('#bblogo3').css('top', '-' + ((scrolledY * 0.3)) + 'px');
$('#bblogo4').css('top', '-' + ((scrolledY * 0.9)) + 'px');
$('#bblogo5').css('top', '-' + ((scrolledY * 0.6)) + 'px');
$('#bblogo6').css('top', '-' + ((scrolledY * 0.1)) + 'px');
$('#bblogo7').css('top', '-' + ((scrolledY * 0.4)) + 'px');
$('#bbspinner').animate(function(){
$(this).css("background","url(images/bblogorender0000.png)");
});
} // <==== Here
});
2
JavaScript验证除了上面的答案从ohgo dwhy,你没有关闭你的document.ready。当你当前的最后一行是:
所以,你需要关闭如上的视差滚动,但你也需要与宣称的功能
});
之前,关闭您的document.ready。
2
你可以用})结束文档准备;但它会在一些浏览器中自动验证,
我建议在IE上测试你的应用程序,这样你就会知道语法错误。
相关问题
- 1. jQuery没有正确地获取东西
- 2. 正确的方式来关闭Chrome时清理一些东西?
- 3. jquery addClass没有应用 - 我可以忽略一些东西吗?
- 4. Rails新手 - 我错过了真正明显的东西吗?
- 5. 有一些关于Javascript继承的东西,我不明白
- 6. 新手jQuery语法错误
- 7. 没有“返回任何东西”的servlet的正确语法?
- 8. C#/ .NET项目 - 我是否正确设置了一些东西?
- 9. 有些东西是不正确的我的数据库类
- 10. if语句错误,我失去了一些东西简单
- 11. JavaScript(有一个按钮打开和关闭的东西)
- 12. 语法错误?可能丢失了一些东西
- 13. 我得到一个语法错误,涉及这些行中的东西
- 14. PHP和JQuery删除正确的东西
- 15. SQL错误说“不正确的语法”=“
- 16. 如果有时只需要,我应该总是返回一些东西吗?
- 17. 使复选框打开和关闭一些东西?
- 18. Javascript/jQuery:如何重新定义一些东西?
- 19. JavaScript:语法错误?是吗?
- 20. MVC路由错误还是我失去了一些东西
- 21. 是在MacBook上重新错误的默认配置?或者我只是误解了一些东西?
- 22. D:dmd说一些真奇怪的东西
- 23. 围绕网格 - 只有东/西错误
- 24. 为什么我会看到黑屏?我没有分配一些东西吗?
- 25. 我在用原子吗?错误还是有其他的东西....?
- 26. MapPoint没有正确关闭?
- 27. javascript - 新东西
- 28. 我有一个sqlite语法错误。什么是不正确的?
- 29. 这是一个可能的Oracle错误还是我错过了一些东西?
- 30. 这是一个mod_rewrite错误还是我错过了一些东西?
谢谢,缺少}关闭视差滚动解决了这个问题。 – coltdorsey 2013-05-04 08:45:06