scrollto

jQuery scroll to div on hover and return to first element

限于喜欢 提交于 2019-12-07 05:02:38
问题 I basically have a div with set dimensions and overflow: hidden . That div contains 7 child divs (but only shows one at a time) that I would like to be smoothly scrolled through vertically when their respective links are hovered. However, the first section (div) doesn't have a link and is the default section when no link is hovered. Take a look at this jsFiddle to see a basic structure of what I'm talking about: http://jsfiddle.net/YWnzc/ I've attempted to accomplish this with jQuery scrollTo

jQuery LocalScroll + hashchange event browser compatibility issue

坚强是说给别人听的谎言 提交于 2019-12-06 15:54:55
问题 I'm building a site where I am using Ariel Fleslers jQuery LocalScroll plugin, which I want to do two things: 1) Animate a scroll to an anchor when a link is clicked 2) Scroll to the previously visited anchor when the browsers' back button is pressed. The scrolling takes place inside a container where the content is overflowing. Number one was straight forward enough. To acheive number two I did a fair bit of googling but didn't really find a solution, even though I came across a few posts by

移动端列表,点击某条记录,进入详情页,返回时定位在刚才点击的位置

℡╲_俬逩灬. 提交于 2019-12-06 14:30:40
在移动web开发过程中,遇到这样一个问题:返回父页面时,父页面会自动刷新。这个机制在某种场景下很好用,但在列表页与详情页之间跳转时就会导致一个很不好的用户体验。那就是详情页回到列表页时会导致页面刷新,列表页又重置为第一页的数据。 要解决这个问题,第一时间想到的就是有没有方法禁用掉浏览器自身的刷新机制,把刷新禁用了,从详情页返回列表页自然就停留在之前访问的位置了。可惜百度了一番,暂未查到如何禁用浏览器的自动刷新功能,该方案只能放弃! 既然没有禁用浏览器刷新的这条捷径,那就只能靠代码来手动实现了。要实现定位到之前点击的那一条所在位置,最重要的是以下两步操作: 1、记录跳转之前列表的页码数。比如我们一页显示10条数据,我们点击的是第3页的第24条数据,那我们要把页码数3记录下来。我们要定位到当前24条数据所在位置,我们至少得从后台请求3页共30条数据过来,否则数据都没有,后续就根本不用想了。 2、记录列表页中滚动条当前滚动的距离。我们想要定位到之前点击的位置,就需要通过此距离让页面重新滚动到对应的位置上。 这两条数据我们可以将其保存到本地缓存中,可选择的有sessionStorage跟localStorage。这里选择sessionStorage比较好,因为sessionStorage会在会话结束之后自动清理掉,会话结束了,我们也不需要这两条记录了。

08.Android之View事件问题

筅森魡賤 提交于 2019-12-06 14:19:51
目录介绍 8.0.0.1 简述Android的事件分发机制?dispatchTouchEvent方法的作用是什么?说下View和ViewGroup分发事件? 8.0.0.2 onInterceptTouchEvent方法作用是什么?onTouchEvent的方法的作用是什么? 8.0.0.4 滑动冲突有哪些场景?滑动冲突处理原则是什么?滑动冲突解决办法有哪些?分别是如何解决的? 8.0.0.5 onTouch()、onTouchEvent()和onClick()关系是怎样的,哪一个先执行?如果设置了onClickListener, 但是onClick()没有调用,可能产生的原因? 8.0.0.6 View滑动有哪些方法?这些方法分别是如何实现滑动的?分别有什么优缺点? 8.0.0.7 事件的传递规则是什么?View处理事件的优先级?点击事件传递过程遵循如下顺序?事件传递规则要点? 8.0.0.8 Scroller的作用?Scroller的要点有哪些?Scroller的使用步骤?Scroller工作原理? 8.0.0.9 Activity事件分发的过程?Window事件分发?DecorView的事件分发?根View的事件分发? 8.0.1.0 GestureDetector是干什么用的?GestureDetector作用和注意点?有哪些常用的监听方法? 8.0.1.2

移动端列表,点击某条记录,进入详情页,返回时定位在刚才点击的位置

谁说胖子不能爱 提交于 2019-12-06 11:29:08
在移动web开发过程中,遇到这样一个问题:返回父页面时,父页面会自动刷新。这个机制在某种场景下很好用,但在列表页与详情页之间跳转时就会导致一个很不好的用户体验。那就是详情页回到列表页时会导致页面刷新,列表页又重置为第一页的数据。 要解决这个问题,第一时间想到的就是有没有方法禁用掉浏览器自身的刷新机制,把刷新禁用了,从详情页返回列表页自然就停留在之前访问的位置了。可惜百度了一番,暂未查到如何禁用浏览器的自动刷新功能,该方案只能放弃! 既然没有禁用浏览器刷新的这条捷径,那就只能靠代码来手动实现了。要实现定位到之前点击的那一条所在位置,最重要的是以下两步操作: 1、记录跳转之前列表的页码数。比如我们一页显示10条数据,我们点击的是第3页的第24条数据,那我们要把页码数3记录下来。我们要定位到当前24条数据所在位置,我们至少得从后台请求3页共30条数据过来,否则数据都没有,后续就根本不用想了。 2、记录列表页中滚动条当前滚动的距离。我们想要定位到之前点击的位置,就需要通过此距离让页面重新滚动到对应的位置上。 这两条数据我们可以将其保存到本地缓存中,可选择的有sessionStorage跟localStorage。这里选择sessionStorage比较好,因为sessionStorage会在会话结束之后自动清理掉,会话结束了,我们也不需要这两条记录了。

Scrolling down to next element via keypress & scrollTo plugin - jQuery

瘦欲@ 提交于 2019-12-06 11:14:08
问题 I am using jQuery's scrollTo plugin to scroll up and down my page, using UP arrow and DOWN arrow. i have a bunch of div with class "screen", as so: <div class="screen-wrapper">...</div> What I am trying to do is, when i press UP or DOWN, the window scrolls to the next, or previous div with class of "screen". I have the keypresses taken care of. According to the plugin docs, to scroll a window, you use $.scrollTo(...); Here's the code I have: $(document).keypress(function(e){ switch (e.keyCode

Scrolling to the next element

隐身守侯 提交于 2019-12-06 09:23:20
问题 I'm struggling with a jquery or javascript problem. It already got annoying which tells me I might think too complicated on this one. So my markup (simplyfied) looks like this: <div class="container"> My Content <a href="#" class="button">scroll down</a> </div> <div class="container"> My Content <a href="#" class="button">scroll down</a> </div> <div class="container"> My Content <a href="#" class="button">scroll down</a> </div> <div class="container"> My Content <a href="#" class="button"

android 如何解决scrollTo无法执行

泪湿孤枕 提交于 2019-12-05 19:56:27
在Activity 的 onCreate() 方法(貌似在onStart和onResume也一样)中, 调用 mScrollView.scrollTo(0, 100); 是无效, 没有效果的. 找了半天, 终于在 http://stackoverflow.com/questions/3263259/scrollview-scrollto-not-working-saving-scrollview-position-on-rotation 找到答案. (Google 还是好过百度啊, 可惜快照不能用了)   scrollTo() 是直接指定滚动条的位置, 但是由于这个动作不是单纯关于 ScrollView 而已, 还要根据 ScrollView 里面包含的View 的实际信息. 所以这动作必须在页面加载完成以后才能执行.   在Activity 初始化过程中, 要指定滚动条位置, 必须用下面的代码:   01.mScrollView.post(new Runnable() {   02. @Override   03. public void run() {   04. mScrollView.scrollTo(0, 1000);   05. }   06.});   post() 方法的说明:   Causes the Runnable to be added to the

scrollTo speed/duration setting

♀尐吖头ヾ 提交于 2019-12-05 15:24:00
Is there a way to speed up the behavior speed of scrollTo? I can't find anything on it, which makes me think not. But If anyone knows better... I had a stab in the dark at speed and duration , but no go. window.scrollTo({ top: 1000, behavior: "smooth" }); https://developer.mozilla.org/en-US/docs/Web/API/Window/scrollTo Pure javascript solution, see the example below: https://jsfiddle.net/rafarolo/zwkesrxh/3/ Minified version: https://jsfiddle.net/rafarolo/8orw7ak3/3/ Just change the second parameter from scrollTopTo function to refine your speed control. // scroll to top (0) in 4 seconds e

jQuery scroll to div on hover and return to first element

主宰稳场 提交于 2019-12-05 12:34:09
I basically have a div with set dimensions and overflow: hidden . That div contains 7 child divs (but only shows one at a time) that I would like to be smoothly scrolled through vertically when their respective links are hovered. However, the first section (div) doesn't have a link and is the default section when no link is hovered. Take a look at this jsFiddle to see a basic structure of what I'm talking about: http://jsfiddle.net/YWnzc/ I've attempted to accomplish this with jQuery scrollTo but haven't been able to get it to work. Any help would be greatly appreciated. Thanks. Something like