Comments (6)
Same issue when the width of the scroll wrapper changes without page reload.
from smooth-div-scroll.
Hi.
I fixed the issue with a new function called on resize event. It's basically a lighter version of recalculateScrollableArea().
recalculateHotSpotsPos: function() { var el = this.element; el.data("scrollerOffset", el.offset()); var tempScrollableAreaWidth = 0, foundStartAtElement = false, o = this.options, el = this.element, self = this; // Add up the total width of all the items inside the scrollable area el.data("scrollableArea").children(o.countOnlyClass).each(function () { // Check to see if the current element in the loop is the one where the scrolling should start if ((o.startAtElementId.length > 0) && (($(this).attr("id")) === o.startAtElementId)) { el.data("startingPosition", tempScrollableAreaWidth); foundStartAtElement = true; } // PATCH : outerWidth(true) makes a bad calculation with margin:0 auto (IE only) var this_width = ($.browser.msie) ? $(this).outerWidth() : $(this).outerWidth(true); tempScrollableAreaWidth = tempScrollableAreaWidth + this_width; }); // Set the width of the scrollable area el.data("scrollableAreaWidth", tempScrollableAreaWidth); el.data("scrollableArea").width(el.data("scrollableAreaWidth")); },
This function needs to be called on resize :
/***************************************** SET UP EVENT FOR RESIZING THE BROWSER WINDOW *****************************************/ $(window).bind("resize", function () { self._showHideHotSpots(); self.recalculateHotSpotsPos(); self._trigger("windowResized"); });
from smooth-div-scroll.
There might be a more elegant way to do it but this does the job.
from smooth-div-scroll.
Hi! I have one question.
When having multiple scrollers (using version 1.3) on a single page hotspot scrolling behaves oddly: it scrolls slowly to the right and when you want to scroll to the left it always jumps at the first picture.
I noticed that this patch here remedies that behaviour, i.e. when I resize the window, suddenly hotspots work perfectly.
How could I call this new "recalculateHotSpotsPos" function onclick when loading a particular part of the page/slider?
from smooth-div-scroll.
Hi.
I found the cause of my specific problem. I am using plugin "Full window width content slider by Karl Oskar Engdahl" which uses Jquery Tools for scrolling content. It somehow messes with the hotspot scrolling.
Since your Resize Window Patch helps my issue, I did a workaround for this conflict issue by firing your patch function not only on window resize but also when hovering the "makeMeScrollable" divs.
I don't know if this is "ok to do" since I am a JS beginner, but it does the job and I need it only for this 1 scrolling minisite...?
Thanks for the patch function!
from smooth-div-scroll.
A plugin developers nightmare is when you start mixing different jQuery plugins, but I know how easy it is to end up there: "If I could just combine the functionality with plugin A with the functionality of function B I'm done!" :-)
I have added one example where I combine Smooth Div Scroll with Colorbox since I think it's a very common user case. But I would of course be impossible to cover all possible combinations. But if you have have a combination of one plugin that would be a great mix together with Smooth Div Scroll let me know and perhaps I can provide an example.
from smooth-div-scroll.
Related Issues (20)
- jScrollPane and Smooth Div Scroll
- Click to center image function not working in scroll gallery HOT 1
- How to change horizontal scroll to vertical scroll in Smooth Div Scoll HOT 2
- Responsive Height
- scroll stopping when mouse out from left and right icons
- I've used this as a navbar on mobile devices and it's worked great until recently...
- Wrong setting when using kinetic.js
- Uncaught TypeError: Cannot read property 'show' of undefined HOT 2
- HTML5 Validation Messages Not Displayed
- Enable vertical Page-Scrolling HOT 4
- Can we use this plugin in commercial website? Is it free? Thanks. HOT 1
- pauseOnHover option when autoScrollingMode: "always" is applied HOT 1
- Still cannot click on href on touchscreens HOT 1
- The last div doesn't show up
- When touch scrolling is enabled, links within an individual block aren't clickable
- Auto Scroll Speed when Mouse approaches ARROWS
- jQuery 3 broke plugin... HOT 2
- Uncaught TypeError: $(...).smoothDivScroll is not a function HOT 1
- Uncaught TypeError: $(...).smoothDivScroll is not a function HOT 1
- Can possible to provide React integration example
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from smooth-div-scroll.