-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Travel Information Slider #458
Changes from 1 commit
e018fe7
0406cff
f273705
8250fb9
3deaa0b
dc325c5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,17 @@ | ||
.wp-block-query.lsx-to-slider { | ||
&.travel-information { | ||
.slick-list { | ||
max-width: 100% !important; | ||
width: 100% !important; | ||
} | ||
|
||
.slick-slide { | ||
padding: 0 !important; | ||
margin: 0 10px !important; | ||
} | ||
Comment on lines
+8
to
+11
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The use of - .slick-slide {
- padding: 0 !important;
- margin: 0 10px !important;
- }
+ .lsx-to-slider.travel-information .slick-slide {
+ padding: 0;
+ margin: 0 10px;
+ } |
||
} | ||
} | ||
|
||
.wp-block-query { | ||
&.lsx-to-slider { | ||
gap: var(--wp--preset--spacing--small) var(--wp--preset--spacing--small); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -197,43 +197,90 @@ if ( window.location.hash ) { | |
* @subpackage scripts | ||
*/ | ||
lsx_to.build_slider = function( window_width ) { | ||
// First slider: .lsx-to-slider | ||
$( '.lsx-to-slider .wp-block-post-template:not(.slider-disabled)' ).each( function() { | ||
var $this = $( this ); | ||
|
||
lsx_to.pre_build_slider( $this ); | ||
|
||
if ( 1 < $this.children.length ) { | ||
|
||
|
||
if ( 1 < $this.children().length ) { | ||
$this.slick( { | ||
draggable: false, | ||
infinite: true, | ||
swipe: false, | ||
dots: false, | ||
slidesToShow: 3, // Show 3 items at a time | ||
slidesToScroll: 1, // Scroll 1 item at a time | ||
autoplay: false, | ||
autoplaySpeed: 0, | ||
appendArrows: $this.parent(), // Ensure arrows are appended correctly | ||
appendDots: $this.parent(), // Append dots in the right container | ||
responsive: [ | ||
{ | ||
breakpoint: 1028, | ||
settings: { | ||
slidesToShow: 2, | ||
slidesToScroll: 1, | ||
draggable: true, | ||
arrows: true, | ||
swipe: true, | ||
dots: true, | ||
} | ||
}, | ||
{ | ||
breakpoint: 782, | ||
settings: { | ||
slidesToShow: 1, | ||
slidesToScroll: 1, | ||
draggable: true, | ||
arrows: true, | ||
swipe: true, | ||
dots: true, | ||
} | ||
} | ||
] | ||
} ); | ||
Comment on lines
+202
to
+244
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The changes made to the first slider look good. The addition of + appendArrows: $this.parent(), // Ensure arrows are appended correctly
+ appendDots: $this.parent(), // Append dots in the right container
+ responsive: [
+ {
+ breakpoint: 1028,
+ settings: {
+ slidesToShow: 2,
+ slidesToScroll: 1,
+ draggable: true,
+ arrows: true,
+ swipe: true,
+ dots: true,
+ }
+ },
+ {
+ breakpoint: 782,
+ settings: {
+ slidesToShow: 1,
+ slidesToScroll: 1,
+ draggable: true,
+ arrows: true,
+ swipe: true,
+ dots: true,
+ }
+ }
+ ] |
||
} | ||
} ); | ||
|
||
// Second slider: .lsx-to-slider.travel-information | ||
$( '.lsx-to-slider .travel-information:not(.slider-disabled)' ).each( function() { | ||
var $this = $( this ); | ||
|
||
lsx_to.pre_build_slider( $this ); | ||
|
||
// Ensure the second slider has 4 slides showing | ||
if ( 1 < $this.children().length ) { | ||
$this.slick( { | ||
draggable: false, | ||
infinite: true, | ||
swipe: false, | ||
dots: false, | ||
slidesToShow: 3, | ||
slidesToScroll: 1, | ||
slidesToShow: 4, // Show 4 items at a time | ||
slidesToScroll: 1, // Scroll 1 item at a time | ||
autoplay: false, | ||
autoplaySpeed: 0, | ||
//appendArrows: $this.parent(), | ||
//appendDots: $this.parent(), | ||
appendArrows: $this.parent(), // Ensure arrows are appended correctly for this slider | ||
appendDots: $this.parent(), // Append dots in the correct place | ||
responsive: [ | ||
{ | ||
breakpoint: 1028, | ||
settings: { | ||
slidesToShow: 2, | ||
slidesToShow: 3, | ||
slidesToScroll: 1, | ||
draggable: true, | ||
arrows: false, | ||
arrows: true, | ||
swipe: true, | ||
dots: true, | ||
} | ||
}, | ||
{ | ||
breakpoint: 782, | ||
settings: { | ||
slidesToShow: 1, | ||
slidesToShow: 1, | ||
slidesToScroll: 1, | ||
draggable: true, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The changes made to the second slider also look good. The number of slides shown at a time has been increased from 3 to 4, which aligns with the PR description. The responsive settings have been updated similarly to the first slider, ensuring a consistent user experience across different screen sizes. + slidesToShow: 4, // Show 4 items at a time
+ appendArrows: $this.parent(), // Ensure arrows are appended correctly for this slider
+ appendDots: $this.parent(), // Append dots in the correct place
+ responsive: [
+ {
+ breakpoint: 1028,
+ settings: {
+ slidesToShow: 3,
+ slidesToScroll: 1,
+ draggable: true,
+ arrows: true,
+ swipe: true,
+ dots: true,
+ }
+ },
+ {
+ breakpoint: 782,
+ settings: {
+ slidesToShow: 1,
+ slidesToScroll: 1,
+ draggable: true,
+ arrows: true,
+ swipe: true,
+ dots: true,
+ }
+ }
+ ] |
||
arrows: false, | ||
arrows: true, | ||
swipe: true, | ||
dots: true, | ||
} | ||
|
@@ -243,7 +290,7 @@ if ( window.location.hash ) { | |
} | ||
} ); | ||
}; | ||
|
||
/** | ||
* Slider Lightbox. | ||
* | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CodeRabbit
The use of
!important
is generally discouraged in CSS as it increases the specificity of a rule, making it harder to override if needed. It's better to increase specificity in a more controlled way, such as by using more specific selectors or by structuring your CSS so that the most specific rules are declared last.