Skip to content

Commit

Permalink
[UPD] Hacer generico el JS del carousel pause
Browse files Browse the repository at this point in the history
  • Loading branch information
ilopezsmx committed Mar 13, 2024
1 parent 01408da commit b752435
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 5 deletions.
2 changes: 0 additions & 2 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,6 @@ module.exports = function (grunt) {
'../../../../../genweb6.core/src/genweb6/core/portlets/rss/rss.js',
'js/templates/multiple_carousel.min.js':
'../../../../../genweb6.core/src/genweb6/core/browser/macros/carousel/multiple_carousel.js',
'js/templates/carousel_pause.min.js':
'../../../../../genweb6.core/src/genweb6/core/browser/macros/carousel/carousel_pause.js',
'js/views/filtered_contents_search.min.js':
'../../../../../genweb6.core/src/genweb6/core/browser/views_templates/filtered_contents_search/filtered_contents_search.js',
'js/dataTables.min.js': 'js/complements/dataTables.js',
Expand Down
26 changes: 26 additions & 0 deletions src/genweb6/theme/theme/js/main/carousel_pause.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
$(document).ready(function() {

$('.carousel-control-pause').click(function() {

var carousel = $(this).closest('.carousel');

if (carousel.hasClass('paused')) {
carousel.carousel('cycle');
carousel.removeClass('paused');
} else {
carousel.carousel('pause');
carousel.addClass('paused');
}

var icon = $(this).find('.bi-pause-fill');

if (icon.length) {
icon.removeClass('bi-pause-fill').addClass('bi-play-fill');
} else {
icon = $(this).find('.bi-play-fill');
icon.removeClass('bi-play-fill').addClass('bi-pause-fill');
}

});

});
1 change: 0 additions & 1 deletion src/genweb6/theme/theme/js/templates/carousel_pause.min.js

This file was deleted.

27 changes: 26 additions & 1 deletion src/genweb6/theme/theme/js/theme-concat.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,32 @@ $(document).ready(function(){
});

/* FIN back_to_top.js */
function copyToClipboard(element) {
$(document).ready(function() {

$('.carousel-control-pause').click(function() {

var carousel = $(this).closest('.carousel');

if (carousel.hasClass('paused')) {
carousel.carousel('cycle');
carousel.removeClass('paused');
} else {
carousel.carousel('pause');
carousel.addClass('paused');
}

var icon = $(this).find('.bi-pause-fill');

if (icon.length) {
icon.removeClass('bi-pause-fill').addClass('bi-play-fill');
} else {
icon = $(this).find('.bi-play-fill');
icon.removeClass('bi-play-fill').addClass('bi-pause-fill');
}

});

});function copyToClipboard(element) {
var $temp = $("<input>");
$("body").append($temp);
$temp.val($(element).html()).select();
Expand Down
2 changes: 1 addition & 1 deletion src/genweb6/theme/theme/js/theme.min.js

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

0 comments on commit b752435

Please sign in to comment.