如何解决猫头鹰轮播:当我点击导航箭头时,下一张幻灯片不会上升到页面顶部
我的滑块很长,需要用鼠标滚动,我将此箭头设置为固定在屏幕中央。
当我点击导航箭头转到下一张幻灯片时,下一张幻灯片没有完全向上滚动的问题。
我已经激活了“自动高度”,如果我直接取消自动高度,它不会向上滚动。
我在wordpress的functions.PHP中创建了这个函数
function salta_hacia_arriba(){ ?>
<script>
jQuery(document).ready(function($) {
/* custom arrows */
$( ".owl-prev").html('<i id="link" class="fa fa-chevron-left"></i>');
$( ".owl-next").html('<i id="link" class="fa fa-chevron-right"></i>');
/* Funcion scroll to anchor */
function scrollToAnchor(aid){
var aTag = $("section[id='"+ aid +"']");
$('html,body').animate({scrollTop: aTag.offset().top},'slow');
}
/* function scroll call */
$("#link").click(function() {
scrollToAnchor('arriba'); //arriba is section at the top of the page ID
});
});
</script>
<?PHP }
add_action('wp_head','salta_hacia_arriba');
这是箭头 html
<div class="owl-nav">
<button type="button" role="presentation" class="owl-prev">
<i id="link" class="fa fa-chevron-left"></i>
</button>
<button type="button" role="presentation" class="owl-next">
<i id="link" class="fa fa-chevron-right">
</i>
</button>
</div>
左箭头运行完美,但右箭头不能完全滚动到页面顶部。
怎么了?
谢谢!!
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。