mirror of
https://github.com/inventree/InvenTree.git
synced 2026-11-24 16:57:30 +00:00
improved carousel layout
This commit is contained in:
1 parent
e74b2ff1c0
commit
92760aa226
3 files changed
+39
-10
No files matched your search
@@ -11,22 +11,36 @@
|
||||
</div>
|
||||
|
||||
<script>
|
||||
document.addEventListener( 'DOMContentLoaded', function () {
|
||||
// With navigation.instant, page content is swapped in without a new
|
||||
// DOMContentLoaded event, so mount immediately if the document has loaded
|
||||
(function () {
|
||||
function mountCarousel() {
|
||||
new Splide(
|
||||
'.splide', {
|
||||
type: 'loop',
|
||||
perPage: {{ per_page }},
|
||||
autoplay: true,
|
||||
pagination: false,
|
||||
// cover: true,
|
||||
// autoWidth: true,
|
||||
height: '25rem',
|
||||
// Each slide is as wide as its image, so that all images
|
||||
// are scaled to the same height (set in extra.css)
|
||||
autoWidth: true,
|
||||
height: '{{ height | default("14rem") }}',
|
||||
breakpoints: {
|
||||
// Narrow screens (e.g. mobile)
|
||||
700: {
|
||||
height: '{{ mobile_height | default("8rem") }}',
|
||||
},
|
||||
},
|
||||
gap: '1rem',
|
||||
focus: 'center',
|
||||
padding: {
|
||||
left: '5rem',
|
||||
right: '5rem',
|
||||
}
|
||||
}
|
||||
).mount();
|
||||
} );
|
||||
}
|
||||
|
||||
if (document.readyState === 'loading') {
|
||||
document.addEventListener('DOMContentLoaded', mountCarousel);
|
||||
} else {
|
||||
mountCarousel();
|
||||
}
|
||||
})();
|
||||
</script>
|
||||
Reference in new issue
Block a user