2013-06-12 66 views
0

好吧,我没有看到的东西我猜...箭头向下链接不起作用

我有一个链接向下的按钮:

HTML:

<button id="get-down"><img src="images/arrow-down.png" /></button> 

CSS:

#intro #get-down{ 
     min-width: 4%; 
     max-width: 4%; 
     position: absolute; 
     z-index: -998; 
     bottom: 2%; 
     left: 46%; 
     border: none; 
     border-radius: 0; 
     visibility: hidden; 
     cursor: pointer; 
    } 

     #intro #get-down > img{ 
      border: none; 
     } 

JS:

// Scroll to demo section 
$(function(toDemos) { 
    $('#get-down').click(function() { 
     $.scrollTo('#content', 500); 
    }); 
}); 

以前的JS代码,当我把它放在列表元素上。但是,这应该能够正常工作?或者我错过了什么?

非常感谢提前!

+0

贵公司的所有元素具有相同的ID?所有这些列表元素都是一样的吗?如果是这样,请改为使用班级。 –

+0

你使用哪个插件? Ariel Flesler是滚动吗? – Learner

+0

'$(function(toDemos){...'做什么? – adeneo

回答

0

尝试使用scrollTop方法代替滚动html元素。

$('html').scrollTop(500); 

或者,如果您的#内容是真正可滚动的,您也可以滚动该内容。

$('#content').scrollTop(500); 
+0

他没有使用jQuery的scrollTop方法,他使用jQuery.ScrollTo插件,该方法名为scrollTo()。 – Learner

+0

啊,好吧,我不知道这个插件。 – devsnd

0

它的工作原理,看看这个http://jsfiddle.net/8eve6/2/ 你确定你已经包括某种形式的jQuery插件的这样一个位置:http://demos.flesler.com/jquery/scrollTo/js/jquery.scrollTo-min.js

<script src="http://demos.flesler.com/jquery/scrollTo/js/jquery.scrollTo-min.js" type="text/javascript"> 
+0

是的,但我的按钮(#geto-down)甚至没有反应在'cursor:pointer'上,虽然它对css的其他部分做出了反应 – Luc

+0

它是#下移还是#geto-down? – Learner

+0

get-down。就像它在html中所说的那样,css和js – Luc