Twitter Bootstrap Carousel 在向左或向右滑动控制时不断向上移动
Twitter Bootstrap Carousel keeps moving up when sliding control left or right
每次我使用左侧或右侧的控件导航/滑动时,我的引导程序 3.3 轮播(代码直接取自 getbootstrap.com(都会不断移动到浏览器顶部。
因此,如果轮播位于页面中间,并且您开始手动滑动,则会向上移动整个页面,直到轮播到达浏览器顶部。
此处的示例:http://crevisio.com/branding/pLXAsNJdn
我该如何纠正此问题?
这是导致网络向上滚动的代码:
$('a[href*=#]').each(function() {
var thisPath = filterPath(this.pathname) || locationPath;
if ( locationPath == thisPath
&& (location.hostname == this.hostname || !this.hostname)
&& this.hash.replace(/#/,'') ) {
var $target = $(this.hash), target = this.hash;
if (target) {
var targetOffset = $target.offset().top;
$(this).click(function(event) {
event.preventDefault();
$(scrollElem).animate({scrollTop: targetOffset}, 800, function() { // <== DISABLE THIS AND THE NEXT 2 LINES
location.hash = target;
});
});
}
}
}(;
问题是 - 为什么要将 click 事件绑定到每个具有 href 属性包含 #
的 A 元素?
轮
播的HTML定义中的href="#carousel-branding-project"
会导致您的页面链接到id="carousel-branding-project"
,这是轮播的父div。
如果您需要将其作为锚点,请尝试将链接更改为href="javascript:void(0)"
<a class="left carousel-control" href="javascript:void(0)"role="button" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left"></span>
</a>
<a class="right carousel-control" href="javascript:void(0)" role="button" data-slide="next">
<span class="glyphicon glyphicon-chevron-right"></span>
</a>
相关文章:
- Twitter Bootstrap Carousel 在向左或向右滑动控制时不断向上移动
- 录制/跟踪html滑块控制移动
- 将滚动条移动到页面中间的控制位置
- 使用 JavaScript/jQuery 进行棘手的精灵移动控制
- 谷歌地图:从BOTTOM_CENTER位置向上移动类型控制按钮
- 使用量角器控制鼠标移动
- 实施垂直移动控制
- 控制页面在确认框的情况下移动到顶部
- 通过鼠标控制窗口移动
- 使用JQuery Mobile向上或向下移动控制组中的多个链接
- 移动时设置输入值'滚动控制'
- 我如何保持变换控制从移动你的对象,如果有碰撞,使用光线投射
- 响应式PhotoSwipe与移动设备上的大控制
- 在画布游戏中使用键盘控制平滑的角色移动
- 360度全景与移动设备传感器控制
- 如何使屏幕上的任意位置单击关闭由jQuery toggle()函数控制的移动菜单
- React.js控制鼠标移动事件保持抛出event.persist()错误
- 蛇游戏与移动按钮控制
- 垂直距离控制如果它溢出到下一行,在移动动态网站
- 如何使用javascript计时来控制鼠标停止和鼠标移动事件