Skip to content

Commit

Permalink
* Dev - Remove the inline attributes for the "data-slick" attribute a…
Browse files Browse the repository at this point in the history
…nd marged them with the JS code.
  • Loading branch information
krugazul committed Aug 28, 2018
1 parent a2c4589 commit 09d8978
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 43 deletions.
2 changes: 1 addition & 1 deletion assets/js/lsx-testimonials.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

92 changes: 54 additions & 38 deletions assets/js/src/lsx-testimonials.js
Original file line number Diff line number Diff line change
@@ -1,44 +1,60 @@
(function ($) {
var $testimonialSlider = $('#lsx-testimonials-slider');
var $testimonialSlider = $('#lsx-testimonials-slider');

$testimonialSlider.on('init', function (event, slick) {
if (slick.options.arrows && slick.slideCount > slick.options.slidesToShow)
$testimonialSlider.addClass('slick-has-arrows');
});
$testimonialSlider.on('init', function (event, slick) {
if (slick.options.arrows && slick.slideCount > slick.options.slidesToShow)
$testimonialSlider.addClass('slick-has-arrows');
});

$testimonialSlider.on('setPosition', function (event, slick) {
if (!slick.options.arrows)
$testimonialSlider.removeClass('slick-has-arrows');
else if (slick.slideCount > slick.options.slidesToShow)
$testimonialSlider.addClass('slick-has-arrows');
});
$testimonialSlider.on('setPosition', function (event, slick) {
if (!slick.options.arrows)
$testimonialSlider.removeClass('slick-has-arrows');
else if (slick.slideCount > slick.options.slidesToShow)
$testimonialSlider.addClass('slick-has-arrows');
});

$testimonialSlider.slick({
draggable: false,
infinite: true,
slidesToScroll: 1,
swipe: false,
cssEase: 'ease-out',
dots: true,
responsive: [{
breakpoint: 992,
settings: {
draggable: true,
arrows: false,
swipe: true
}
}, {
breakpoint: 768,
settings: {
slidesToShow: 1,
draggable: true,
arrows: false,
swipe: true
}
}]
});
var slidesToScroll = 1;
var slidesToShow = 1;
var overrides = $testimonialSlider.attr( 'data-lsx-slick' );
if ( undefined !== overrides && false !== overrides ) {
overrides = jQuery.parseJSON( overrides );
console.log( overrides );
if ( undefined !== overrides.slidesToShow && '' !== overrides.slidesToShow ) {
slidesToShow = overrides.slidesToShow;
}
if ( undefined !== overrides.slidesToScroll && '' !== overrides.slidesToScroll ) {
slidesToScroll = overrides.slidesToScroll;
}
}

$('.single-testimonial a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
$('#lsx-services-slider, #lsx-projects-slider, #lsx-products-slider, #lsx-testimonials-slider, #lsx-team-slider, .lsx-blog-customizer-posts-slider, .lsx-blog-customizer-terms-slider').slick('setPosition');
});
$testimonialSlider.slick({
draggable: false,
infinite: true,
slidesToScroll: slidesToScroll,
slidesToShow: slidesToShow,
swipe: false,
cssEase: 'ease-out',
dots: true,
responsive: [{
breakpoint: 992,
settings: {
draggable: true,
arrows: false,
swipe: true
}
}, {
breakpoint: 768,
settings: {
slidesToShow: 1,
slidesToScroll: 1,
draggable: true,
arrows: false,
swipe: true
}
}]
});

$('.single-testimonial a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
$('#lsx-services-slider, #lsx-projects-slider, #lsx-products-slider, #lsx-testimonials-slider, #lsx-team-slider, .lsx-blog-customizer-posts-slider, .lsx-blog-customizer-terms-slider').slick('setPosition');
});
})(jQuery);
3 changes: 3 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
## Changelog

### 1.1.5
* Dev - Remove the inline attributes for the "data-slick" attribute and marged them with the JS code.

### 1.1.4
* Dev - Removed the deprecated "create_function" call
* Fix - Fixing the broken method name 's_numeric'
Expand Down
2 changes: 1 addition & 1 deletion classes/class-lsx-testimonials.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ public function output( $atts ) {
}

if ( 'true' === $carousel || true === $carousel ) {
$output .= "<div id='lsx-testimonials-slider' class='lsx-testimonials-shortcode' data-slick='{\"slidesToShow\": $columns, \"slidesToScroll\": $columns }'>";
$output .= "<div id='lsx-testimonials-slider' class='lsx-testimonials-shortcode' data-lsx-slick='{\"slidesToShow\": $columns, \"slidesToScroll\": $columns }'>";
} else {
$output .= "<div class='lsx-testimonials-shortcode'><div class='row'>";
}
Expand Down
4 changes: 2 additions & 2 deletions lsx-testimonials.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: LSX Testimonials
* Plugin URI: https://www.lsdev.biz/product/lsx-testimonials/
* Description: The LSX Testimonials extension adds the "Testimonials" post type.
* Version: 1.1.4
* Version: 1.1.5
* Author: LightSpeed
* Author URI: https://www.lsdev.biz/
* License: GPL3
Expand All @@ -20,7 +20,7 @@
define( 'LSX_TESTIMONIALS_PATH', plugin_dir_path( __FILE__ ) );
define( 'LSX_TESTIMONIALS_CORE', __FILE__ );
define( 'LSX_TESTIMONIALS_URL', plugin_dir_url( __FILE__ ) );
define( 'LSX_TESTIMONIALS_VER', '1.1.4' );
define( 'LSX_TESTIMONIALS_VER', '1.1.5' );


/* ======================= Below is the Plugin Class init ========================= */
Expand Down
2 changes: 1 addition & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Tags: lsx, lsx theme, testimonials, post type, front-end
Requires at least: 4.3
Tested up to: 4.9.4
Requires PHP: 7.0
Stable tag: 1.1.4
Stable tag: 1.1.5
License: GPLv3

The LSX Testimonial plugin The LSX Testimonials extension adds the “Testimonials” post type, which you can display front-and-centre on your site.
Expand Down

0 comments on commit 09d8978

Please sign in to comment.