You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The idea is to have multiple carousels through ng-repeat. So far this works fine - until I need to carry out beforeChange events that perform an auto-height workaround (this works great on one carousel by the way).
How can I create different settings for multiple carousels that are in an ng-repeat?
This directive gets an ID from the carousel via a slickinit attribute, then as you can see, I have slickConfig which I added to the settings attribute like this settings="slickConfig" as normal. From this you can tell that $scope.slickConfig will be the same all the time because it's not unique to a particular carousel. Then the result of this is that somewhere down there, I do the beforeChange event and in this event I do the auto-height workaround.
This is the auto-height script in there: $('.slider' + autoheight_properties_property_id).animate({ height: $('.slider' + autoheight_properties_property_id).find('.slidesimg' + autoheight_properties_property_id + '.slick-active').height() }, 500);
The slider to update height has a class name with an id at the end and in the HTML it looks as follows,
Where the class of the carousel is slider{{x.properties_property_id}}. When I run the code, it does the auto-height on the last carousel only, which is not surprising because $scope.slickConfig gets the last carousel only. How then can one have different settings for different carousels.
What I tried
Adding the setting directly in the HTML - but I was unsure of how to add events like init with their functions in the carousel element as one would do with the others like:
I have the same issue ,I want to populate multiple carousel for displaying the products. But the carousel controls not working properly. There is any way to fix that like by giving unique id's to every populated carousel.
The idea is to have multiple carousels through ng-repeat. So far this works fine - until I need to carry out
beforeChange
events that perform an auto-height workaround (this works great on one carousel by the way).How can I create different settings for multiple carousels that are in an ng-repeat?
This directive gets an ID from the carousel via a
slickinit
attribute, then as you can see, I haveslickConfig
which I added to the settings attribute like thissettings="slickConfig"
as normal. From this you can tell that$scope.slickConfig
will be the same all the time because it's not unique to a particular carousel. Then the result of this is that somewhere down there, I do thebeforeChange
event and in this event I do the auto-height workaround.This is the auto-height script in there:
$('.slider' + autoheight_properties_property_id).animate({ height: $('.slider' + autoheight_properties_property_id).find('.slidesimg' + autoheight_properties_property_id + '.slick-active').height() }, 500);
The slider to update height has a class name with an id at the end and in the HTML it looks as follows,
Where the class of the carousel is
slider{{x.properties_property_id}}
. When I run the code, it does the auto-height on the last carousel only, which is not surprising because$scope.slickConfig
gets the last carousel only. How then can one have different settings for different carousels.What I tried
Adding the setting directly in the HTML - but I was unsure of how to add events like
init
with their functions in the carousel element as one would do with the others like:Does anyone know how to achieve this?
The text was updated successfully, but these errors were encountered: