pianello-api/resources/js/components/preview-component/index.js
Ale Gallo 82f958e5da Committing laravel (part 3)
committing js templating files and components
2023-11-10 16:00:59 +01:00

20 lines
655 B
JavaScript

(function () {
"use strict";
// Show code or preview
$(".preview-component").each(function () {
const previewComponent = this;
$(this)
.find('input[type="checkbox"]')
.first()
.on("click", function () {
if ($(this).is(":checked")) {
$(previewComponent).find(".preview").hide();
$(previewComponent).find(".source").fadeIn(200);
} else {
$(previewComponent).find(".preview").fadeIn(200);
$(previewComponent).find(".source").hide();
}
});
});
})();