Comments (5)
Hi there. I have not worked with Mixitup previously. Do you have a URL you can point me to so I can see the behavior that is occurring?
from flexisel.
You can see it in action here, with no modifications made to the default flexisel.js file: http://sandbox.webmastr.ca/oeuvres/
I can get it to work properly the first time it loads by changing var totalItems to:
var nbItems = object.children().length; var totalItems = nbItems - (nbItems - object.children('[style*="opacity"]').length); // Visible elements have an attribute with opacity: 1, invisible items do not
However, I can't get it to dynamically refresh that value after the initial load (i.e. when Mixitup filters the items and the animation has ended)
from flexisel.
Ah, I see what you are referring to. Okay, so the challenge here is that Flexisel, in attempting to handle to responsive situations, is always trying to determine "How many items should I show?" based on the visibleItems property set in the options at different widths. So it's always going to be setting the width of items based off of the screen width. It doesn't differentiate whether the opacity of an item is 0 or 1. Rather than trying to reinitialize everything (because a bunch of HTML gets appended on init), the best approach would probably be trying to customize the visibleItems value after scroll events (see the adjustScroll method which runs afrer any scrolling left or right). A custom getVisibleItems method that returns the current number of items with opacity of 1 (but not less than the maximun number set for that width) could be used instead of the visibleItems property to calculate the number of items to show. Adding something like that in is probably the best way to handle what you're wanting to accomplish.
from flexisel.
Very insightful, thank you! I got it to work by creating a simple getVisibleItem method that returns the current number of items that have the attribute opacity as follows:
getVisibleItems : function() { return currentNbItems = object.children('[style*="opacity"]').length; }
And then called that method instead of totalitems in var objPosition of the ScrollRight method:
var objPosition = (object.position().left + ((methods.getVisibleItems()-itemsVisible)*itemsWidth)-innerWidth);
Works like a charm, but it messes up when i resize the browser. It stops scrolling one item short depending on the window width. Sometimes it works fine, other times it won't scroll to the last item
from flexisel.
Very nice! Seems like it's close. I don't have too much time at the moment but probably a good first step in trying to resolve this last bit would be to look at perhaps applying some of the modifications you have made also to the code inside the $(window).on("resize"... event in the setEventHandlers method. I can maybe try to take another look at it if you run into difficulties when I'm a bit more free up.
from flexisel.
Related Issues (20)
- - increment margin between items HOT 2
- Multiple calls on window resize HOT 4
- Element order when set infinitely:true HOT 4
- Slides. second item overlaps with previous and next one HOT 2
- Need to trigger methods.scroll(true); from page on mouseover event. HOT 1
- Dynamic Data Binding HOT 1
- visibleItem:1 is not working properly HOT 2
- Can this flexisel compatible with ie8 HOT 2
- Can we turn off slider on small widths HOT 3
- swipe is left or right? HOT 1
- Event Propagation HOT 1
- How to disable touch swipe HOT 1
- When autoplay is enabled, DOM gets bombarded with duplicate clones. HOT 3
- How install in angualr js..? HOT 2
- Disable next button condition HOT 1
- Add bullets pagination HOT 1
- Needs a up/down carousal animation HOT 1
- Pause Slider until it's visible in the viewport
- For many picture norounded value problem solved liked below
- Not working with latest jquery version 3.x HOT 1
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 flexisel.