Tag: 平滑滚动

jQuery Smooth to Scroll to Top AND to Anchor by ID

我找到了将jQuery滚动添加到顶部或滚动到锚点的答案,但实际上并没有集成。 所以希望可以在这里问一下。 我们有当前的jQuery函数来为较长的页面添加滚动到顶部的锚点。 它工作正常。 // Add To Top Button functionality jQuery(document).ready(function($){ // Scroll (in pixels) after which the “To Top” link is shown var offset = 700, //Scroll (in pixels) after which the “back to top” link opacity is reduced offset_opacity = 1200, //Duration of the top scrolling animation (in ms) scroll_top_duration = 700, //Get […]

平滑滚动问题

我使用以下js代码在页面上平滑滚动。 问题是我使用以下JS后无法使用mycarousel的导航。 反正有没有修复我的后续js所以它不会影响我的旋转木马导航。 因为轮播导航上的# (href =“#myCarousel”)而发生此问题。 那么在这种情况下如何解决问题。 $(function() { $(‘a[href*=#]:not([href=#])’).click(function() { if (location.pathname.replace(/^\//,”) == this.pathname.replace(/^\//,”) && location.hostname == this.hostname) { var target = $(this.hash); target = target.length ? target : $(‘[name=’ + this.hash.slice(1) +’]’); if (target.length) { $(‘html,body’).animate({ scrollTop: target.offset().top }, 1000); return false; } } }); }); 我的轮播导航:

jQuery Next / Prev Smooth Scrolling和WordPress?

jsFiddle中的示例我想在http://jsfiddle.net/HRewD/17/中工作 但是..当我尝试在wordpress中实现时,没有平滑的滚动链接:( 我觉得它可能与$’s有关,所以我将它们全部从$改为jQuery,这通常有效,但不是这次。 我也尝试使用jQuery.noConflict(),但没有运气。 我目前正在本地工作,所以我目前无法在线链接。 我有一些其他插件可以正常工作,调用jQuery,所以jQuery 1.6.4肯定是在加载。 我意识到我没有给予很多工作,但我真的很感激能帮助我解决这个问题。 因为在这一点上我很难过。 所以,如果有人伸出援手,我将不胜感激。 更新: 我一直在研究和解决这个问题,并进一步缩小了它,但我仍然在努力绕过所有这一切。 我在控制台中收到一个错误,这是因为一个看不见的字符(我猜是由JSFiddle创建的?!)。 我在代码中的不同位置运行了一个简单的警报function,它显示正常。 截至目前,我没有注意到safari,FF和Opera的开发者工具的控制台或“资源”部分中的任何错误,但仅在chrome中我收到错误 event.layerX and event.layerY are broken and deprecated in WebKit. They will be removed from the engine in the near future. 只有在单击下一个或上一个后,我才会收到此错误,错误左侧的数字会在每次单击后以2为增量增加。 我的HTML: Content Goes here A box of content Content More content… Previous Next 我的css: #home-block div{ width: 300px; height: […]

JQuery滚动到点击锚点?

基本上我有这个function是一个创建分页的类。 我想以某种方式使用平滑滚动将页面移回注释容器div的顶部但不确定我需要在哪里或什么function。 var Comments = function(options) { this.options = { id: 0, page: 0, object: null, name: null, parentid: 0, folder: ‘./’ }; this.options = $.extend(this.options, options || {}); this.getComments = function(page) { this.options.page = page; var object = this.options.object; var data = ‘objid=’ + this.options.name; $.ajax({ type: “GET”, url: this.options.folder + ‘backend.php’, data: data, […]

链接到不同的页面 – > jquery滚动到特定的锚点

在我的主页底部,我已经包含了一个联系表单,并将此部分的锚点指定为div id =“contact”。 当在任何页面上单击联系人按钮时,它应该导航到主页并在页面加载时,自动滚动到联系人表单。 在查看了我在这里找到的类似问题之后,我一直没有成功地开始工作: jQuery从不同页面滚动到ID当我尝试时,它只是跳转到表单。 我想让它顺利滚动。 Get in touchContact 问题jquery函数从其他页面滚动到主页上的联系人锚点: (function($){ var jump=function(e) { if (e) { e.preventDefault(); var target = $(this).attr(“href”); } else { var target = location.hash; } $(‘html,body’).animate({ scrollTop: $(target).offset().top },1000,function() { location.hash = target; }); } $(‘html, body’).hide() $(document).ready(function() { $(‘a[href^=#]’).bind(“click”, jump); if (location.hash) { setTimeout(function(){ $(‘html, body’).scrollTop(0).show() jump() }, […]