Skip to content

Instantly share code, notes, and snippets.

View alessandroalessio's full-sized avatar

Alessandro Alessio alessandroalessio

View GitHub Profile
@alessandroalessio
alessandroalessio / index.html
Last active March 29, 2023 10:01
Tabs System with HTML, Tailwind CSS and Vanilla JS
<div class="atw-tabs">
<div class="atw-tabs-labels">
<button class="tab-btn active" data-tab="tab1">Tab 1</button>
<button class="tab-btn" data-tab="tab2">Tab 2</button>
<button class="tab-btn" data-tab="tab3">Tab 3</button>
</div>
<div class="tab-content">
<div class="tab-pane active" data-tab="tab1">
<h3 class="text-xl">Tab 1</h3>
<p>Lorem ipsum dolor sit amet</p>
@alessandroalessio
alessandroalessio / script.js
Created November 30, 2021 14:28
Vanilla Javascript Page Loader
// Page Loader
document.addEventListener('readystatechange', function(event) {
if (document.readyState === "complete") {
setTimeout(function(){
document.getElementById('loader').classList.add('hide');
}, 1000);
}
});
window.addEventListener( 'beforeunload', function( event ) {
@alessandroalessio
alessandroalessio / gist:c57171db5c53354f85b367ad7c5f00b5
Created April 18, 2020 15:34
owlCarousel 2 managed by Data Attribute
// Carousel
if ( jQuery('.owl-carousel').length ) {
jQuery.each( jQuery('.owl-carousel'), function(){
var owlItems = jQuery('.owl-carousel').data('items') ? jQuery('.owl-carousel').data('items') : 3;
owlOptions = [];
if ( typeof jQuery(".owl-carousel").data('items') !== 'undefined' ) owlOptions['items'] = jQuery(".owl-carousel").data('items');
if ( typeof jQuery(".owl-carousel").data('loop') !== 'undefined' ) owlOptions['loop'] = jQuery(".owl-carousel").data('loop');
if ( typeof jQuery(".owl-carousel").data('margin') !== 'undefined' ) owlOptions['margin'] = jQuery(".owl-carousel").data('margin');