【发布时间】:2013-12-18 09:07:25
【问题描述】:
我是这个菜鸟所以我想问你是否知道如何选择除一个以外的所有元素。
这是脚本:
<script type="text/javascript">
var jump = function (e) {
//prevent the "normal" behaviour which would be a "hard" jump
e.preventDefault();
//Get the target
var target = $(this).attr("href");
//perform animated scrolling
$('html,body').animate({
//get top-position of target-element and set it as scroll target
scrollTop: $(target).offset().top
//scrolldelay:1 seconds
}, 1000, function () {
//attach the hash (#jumptarget) to the pageurl
location.hash = target;
});
}
$(document).ready(function () {
$('a[href*=#]').bind("click", jump);
return false;
});
</script>
<!-- // end of smooth scrolling -->
我想对除 #myCarousel 之外的所有链接做同样的效果。问题是如何做到这一点以及需要在哪里包含:不是脚本中的选择器。
提前致谢。
【问题讨论】:
标签: javascript jquery twitter-bootstrap