scrollto

JQuery插件:ScrollTo平滑滚动到页面指定位置

≡放荡痞女 提交于 2020-02-29 03:34:44
ScrollTo是一款基于jQuery的滚动插件,当点击页面的链接时,可以平滑地滚动到页面指定的位置。适用在一些页面内容比较多,页面长度有好几屏的场合,本文以DEMO为示例讲解该插件的应用。 查看演示DEMO 使用方法 1、准备jQuery库和scrollTo.js插件。 <script type="text/javascript" src="js/jquery.js"></script> <script type="text/javascript" src="js/jquery.scrollTo.js"></script> 2、XHTML <ul class="nav"> <li><a href="#" class="nav_pro">产品展示</a></li> <li><a href="#" class="nav_news">新闻中心</a></li> <li><a href="#" class="nav_ser">服务支持</a></li> <li><a href="#" class="nav_con">联系我们</a></li> <li><a href="#" class="nav_job">人才招聘</a></li> </ul> <div id="pro" class="box"> <h3>产品展示</h3> </div> <div id="news" class=

H5开发遇到的问题,以及苹果兼容的一些坑

那年仲夏 提交于 2020-02-26 23:10:30
1.H5的localStorage第二次打开的时候不会清除,例如: 微信公众号第一次登陆之后存一个 localStorage.setItem("login","true"); 然后关闭微信,再重新进去,获取 localStorage.getItem("login"); 这个打印出来的值是为true的。 2.苹果手机微信用的WKWebview内核,跨域请求接口的时候不会携带上cookie,无法验证登录,会导致接口无权限或者404。 解决方法:服务器采用nginx反向代理,项目和请求接口的链接都换成相同的域名,解决跨域问题,也解决了苹果微信跨域请求不携带cookie的问题。 3.vue项目保存登录状态的问题,刷新后导致全局变量改变,登录状态还原导致刷新就会退出登录。 解决方法:刷新的时候把全局变量存到localStorage window.addEventListener("beforeunload",()=>{ localStorage.setItem("userState",JSON.stringify(state)) }); 在页面重新加载时再从localStorage里面更新全局变量 localStorage.getItem("userState") && this.$store.replaceState(Object.assign(this.$store.state,JSON

jScrollPane scrollbar disappears when applying scrollTo

☆樱花仙子☆ 提交于 2020-01-11 12:33:00
问题 I have a problem with the jQuery extension jScrollPane combined with the scrollTo plugin. The scrollbar disappears if I apply the scrollTo command to the scrollable container and the scroll is at the top position . (If the scroll is not at the top position, everything is working fine.) To get the scrollbar back, I try to reinitialize it. What happens then is that the scroll goes back to the top, canceling the scrollTo command. My code: $('#myScrollableDiv div.jspContainer').scrollTo(delta); c

jScrollPane scrollbar disappears when applying scrollTo

早过忘川 提交于 2020-01-11 12:32:30
问题 I have a problem with the jQuery extension jScrollPane combined with the scrollTo plugin. The scrollbar disappears if I apply the scrollTo command to the scrollable container and the scroll is at the top position . (If the scroll is not at the top position, everything is working fine.) To get the scrollbar back, I try to reinitialize it. What happens then is that the scroll goes back to the top, canceling the scrollTo command. My code: $('#myScrollableDiv div.jspContainer').scrollTo(delta); c

jQuery滚动到元素

夙愿已清 提交于 2020-01-07 04:19:23
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 我有这个 input 元素: <input type="text" class="textfield" value="" id="subject" name="subject"> 然后,我还有其他一些元素,例如其他文本输入,文本区域等。 当用户使用 #subject 单击该 input 时,页面应滚动到页面上具有精美动画的最后一个元素。 它应该是滚动到底部而不是顶部。 页面的最后一项是带有 #submit 的 submit 按钮: <input type="submit" class="submit" id="submit" name="submit" value="Ok, Done."> 动画不应太快且应流畅。 我正在运行最新的jQuery版本。 我更喜欢不安装任何插件,而是使用默认的jQuery功能来实现此目的。 #1楼 jQuery .scrollTo(): 查看-演示,API,源 我写了这个轻量级的插件,以使页面/元素滚动更加容易。 在可以传递目标元素或指定值的地方,它很灵活。 也许这可能是jQuery的下一个正式版本的一部分,您认为呢? 用法示例: $('body').scrollTo('#target'); // Scroll screen to target element $('body')

Is there a way to inform the screen reader about a transition to a new section on the same page?

三世轮回 提交于 2020-01-05 04:09:15
问题 I have a page that has 2 steps to register a user. After a user has filled out all fields of the first section, he needs to confirm the "Terms and Conditions" and press a button to confirm it. After he has pressed the button, first section is becomes readOnly and the second section (more fields to fill) appears at the bottom of the page and the page does a scrollTo this new section. I need to inform the screen reader that there is a new section on the same page but I don't know who can I do

Jquery ScrollTo issue

拈花ヽ惹草 提交于 2019-12-25 08:35:01
问题 I am using Jquery ScrollTo so that when I click a question at the top of the page it will scroll to the question and answer further down the screen. This function works ok ( To a point) Now when I click to a question that is say halfway down the page it will scroll and my navbar will overlap half of the question ( i am using twitter bootstrap fixed navbar) The second issue is that when I click Top ( should scroll back to top of page) the first 3 questions are overlapped by the navbar. If I

scrollTo and horizontal tables

醉酒当歌 提交于 2019-12-24 19:16:24
问题 I am attempting to make a horizontal scrolling portfolio site. I want to users to be able to click through the images using a next/previous button as well as scrolling as per usual with the mouse and scroll bars. I am, however, having trouble implementing this using jquery. The table is used as this is best practice in horizontal websites. I wish to use the scrollTo() plugin to allow the table to scroll forwards or backwards depending on which button is clicked. The end product would resemble

Firefox jquery scrollTo flicker bug

允我心安 提交于 2019-12-23 10:09:56
问题 I've seen quite a few threads here talking about flickering in Firefox, but none that quite describe the problem I'm having. I've got a horizontal scrolling website, fixed position menus, and the jquery plugin .scrollTo handling next and previous buttons. This works great in Chrome and Safari (don't know about IE), but in Firefox there is a flicker every time you scroll right of left with the arrows in the upper right and corner. See An Example Here I've tried setting all the elements that

JQUERY, scrollTo, after scrolling down, the page won't let me scroll up for a second… Y?

早过忘川 提交于 2019-12-23 04:09:19
问题 I'm using the following JQUERY to attach an even to a link in the header, which essentially scrolls to the bottom of the page: $('#comment-count-btn').click(function(){ $('html,body').scrollTo('#comment-wrapper', 500); }); Problem is, that it scrolls all the way to the bottom of the page (which is correct), but then when I try to scroll up a tad, the scroll bar jumps, as if it's locked for a little bit. Any ideas? 回答1: Try adding return false; in the end of click() function. Also, try