JQuery Scrolling event fire many time - javascript

Here is my scenario I have a web page which will navigate through using mousewheel and scrollbar. I have fixed the mousewheel problem.... But the problem where I use the scrollbar it will navigate to the end or go to the first it depending on the scrollbar you pressed up or down.
I know the error is $(window).scroll(function) here due I navigate from Div 1 to Div 2 which will fire the event a lot of times when the scroll bar moving.
Here is my fiddle
The problem is where i when i scroll using the bar beside down or up. It will trigger until the end of my onscroll event.
Is it possible when i press the scrollbar once only trigger once ?
An alternative way i know is hide the scrollbar and design a fixed position button up and down will resolve this problem but is it possible to do this with default scrollbar/overflow ?

Tried your fiddle. When using mouse wheel, it kept pending between headers 4 and 3 after I reached the 4th one. When I removed the $(window).scroll() function, it worked perfectly, both down and up.
The scrollbar, however, is quite a complicated issue - when you click/tap and drag, you simply can't "steal" the scrollbar from your pointer/finger - the user keeps dragging, yet you're trying to reposition the scrollbar/content forcibly. I don't think this is a good idea (from the UX point of view).
Not sure if it fits your requirements but in case I'd want to fully control the content, I'd completely remove the scrollbar in CSS and then use the mousewheel or swipe functions to control it.

Related

jQuery chosen scroll issue, element which contains the chosen doesn't scroll

I am facing some issues with the jQuery Chosen plugin. Here are some screenshots:
The focused Users input is a jQuery Chosen select input within a tab in a Bootstrap dialog (but this doesn't matter anyway). As you can see the scroll of the Chosen's ul.chosen-results didn't reach the bottom here.
Now if I scroll down the results:
I reach the bottom of ul.chosen-results, but if scroll with the mouse wheel down further from this point on, the rightmost scroll doesn't scroll down.
But I would like the other scroll to go down too from that point on while scrolling down ul.chosen-results with the bottom scroll of ul.chosen-results reached, to achieve this:
See that the rightmost scrollbar is down here too. This is what I want to reach while scrolling on ul.chosen-results. Does Chosen somehow inhibit the scroll event propagation when scrolling ul.chosen-results?
Can I achieve what I want? How?
Thanks for the attention!
In the not minified js plugin file
find following code
high_top = this.result_highlight.position().top + this.search_results.scrollTop();
and replace it by this.
high_top = this.result_highlight.position().top;
This issues has been addressed here another possible fix is to update to jQuery 2.2.1

Scroll horizontal with fullPage.js, is it possible with the mouse wheel?

I am using fullPage.js for a one pager website. It works beautifully. It has support for scrolling through full page slides at the flick of the scroll wheel, and each slide can also contain a horizontal slideshow, normally triggered at that point by clicking one of the side arrows.
I want to force the user to scroll through that slideshow before they can progress down to the next slide. Does anyone know of a way to allow the slideshow to be triggered with the mouse wheel when scrolling down? Then when it hits the end of that slideshow it scrolls vertical again to the next slide?
You can do it with jquery.mousewheel like:
$('#fullpage').on('mousewheel', function(event) {
if (event.deltaY > 0){$.fn.fullpage.moveSlideRight();}
else{$.fn.fullpage.moveSlideLeft();}
});
https://github.com/jquery/jquery-mousewheel
Update 2016
Now fullPage.js provides the Scroll Horizontally extension for it.
What you want to accomplish is not that simple to implement in the plugin. Also, I would say forcing the user to follow a path is not consider as a good practice from the user experience point of view.
Also, what should happen once the user reach the next section and then scrolls up? Should he follow all the way back throw the slides of the previous section again in order to keep moving up ?
Anyway, if you want to accomplish it by your own, you would need first of all, to avoid the auto scrolling behavior when scrolling withing your slides (or the section slides for which you want to apply this).
And then, you would need to change the scrolling behavior to trigger the action to go to the next or to the previous slide by triggering the control arrows events depending on the scrolling direction.
Once the end of the slider is reached, you would need to add again the auto scrolling even.
It really doesn't sound simple if you want to do it by your own. You would need to recode the plugin.

How to make div document selected without clicking on it using jquery ? (Auto suggest with Scrolbar)

I am working facing issue in auto suggest with scroll bar. I have to make scroll bar movable on arrow key down, mouse wheel its works fine for me. If I use document keydown event its moving my browser scroll.
I just looking for a functionality with arrow keydown scroll should move. If I click inside the div and try to move scroll bar with arrow keydown its works but if I am not clicking inside div, since document is not clicked scroll bar doesn't work.
I used slimscroll and currently working with enscroll-0.4 plugins but not able to make it fixed. Feel free to ask if you are not clear about my question.
It will be really helpful if anyone have a solution for this issue.

jScrollPane Middle-mouseclick doesn't work

On most websites, you can press your scroll wheel and drag the mouse around in order to scroll. I use this all the time, and I'm sure others do too.
However when I use jScrollPane to replace the scroll bar, it simply doesn't work. Is there any workaround available?
Edit: Video to clarify what I mean, on the first page it works, but not on the second one.
http://screencast-o-matic.com/watch/cX60XpOwT
This is not possible without either 1) creating a custom method for handling middle-click and scroll or 2) in someway hiding the orginal scrollbar under something else or out of the screen. So theoretically, it's possible, but it's not included in jScrollPane at this time.

Differentiate between a scroll caused by .scrollLeft and a user trying to scroll in an HTML page

I have a scrollbar that has to follow some timeline. It is being constantly scrolled with .scrollLeft using setInterval.
I still want the user to be able to naturally take control and just drag the scrollbar away. If I can detect the user did that, I would just turn off the setInterval timer and leave the control to the user until he explicitly turns the auto scroll back on.
Is there a way to differentiate the user scroll event, from the scroll created by .scrollLeft?
You can set a flag before changing scrollLeft and clear it afterwards, then check the flag in the scroll event.
Since Javascript is run on the UI thread, it is not possible for the user to scroll while your code is running.
One alternative is to give up using a scroll-bar at all and do it using CSS and a jQuery slider control. This also gives you the option of making it look more like a time-line. you can set the scroller elements to whatever CSS you want.
There are a few out there, but it's not too hard to roll-your-own using a jQuery draggable control and constraining one axis inside a long, narrow container DIV.

Categories

Resources