Skip to content

Instantly share code, notes, and snippets.

View TeamBug99's full-sized avatar

Shanjadul Islam TeamBug99

View GitHub Profile
@TeamBug99
TeamBug99 / index.html
Created August 27, 2023 14:56
Smooth Accordion with TailwindCSS & Alpine.js
<div class="bg-gray-100 h-screen w-screen flex justify-center">
<div class="mr-8">
<h1 class="font-medium max-w-xl mx-auto pt-10 pb-4">Smooth Accordion</h1>
<div class="bg-white max-w-xl mx-auto border border-gray-200" x-data="{selected:1}">
<ul class="shadow-box">
<li class="relative border-b border-gray-200">
<button type="button" class="w-full px-8 py-6 text-left" @click="selected !== 1 ? selected = 1 : selected = null">
@TeamBug99
TeamBug99 / Scroll up
Created September 22, 2021 19:15
Scroll up
<!--Scroll to top-->
<div class="scroll-to-top scroll-to-target" data-target="html"><span class="fa fa-angle-up"></span></div>
//Update Header Style and Scroll to Top
function headerStyle() {
if($('.main-header').length){
var windowpos = $(window).scrollTop();
var siteHeader = $('.main-header');
var scrollLink = $('.scroll-to-top');
if (windowpos >= 1) {
@TeamBug99
TeamBug99 / One page menu
Created September 22, 2021 19:14
One page menu
// Menu Nav
function smoothSctollTop() {
$('.main-menu ul li > a').on('click', function (event) {
var target = $(this.getAttribute('href'));
if (target.length) {
event.preventDefault();
$('html, body').stop().animate({
scrollTop: target.offset().top - 80
}, 1000);
}
@TeamBug99
TeamBug99 / WP Basic functions
Created September 22, 2021 19:14
WP Basic functions
// loop
<?php while(have_posts()): the_post(); ?>
<h2 class="post-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
<?php endwhile; ?>
//Thumbnail
<?php
if(has_post_thumbnail()){
the_post_thumbnail("large", array('class' => 'img-fluid'));
}
@TeamBug99
TeamBug99 / Slick slider animation
Created September 22, 2021 19:13
Slick slider animation
function mainSlider() {
var BasicSlider = $('.slider-active');
BasicSlider.on('init', function(e, slick) {
var $firstAnimatingElements = $('.single-slider:first-child').find('[data-animation]');
doAnimations($firstAnimatingElements);
});
BasicSlider.on('beforeChange', function(e, slick, currentSlide, nextSlide) {
var $animatingElements = $('.single-slider[data-slick-index="' + nextSlide + '"]').find('[data-animation]');
doAnimations($animatingElements);
});
@TeamBug99
TeamBug99 / owl-dots numbering
Created September 22, 2021 19:13
owl-dots numbering
// way one
var i = 1;
$('.owl-carousel .owl-dot').each(function(){
$(this).text(i);
i++;
});
//way two
var dot = $('.slideWrap .owl-dot');
@TeamBug99
TeamBug99 / Basic jQuery
Created September 22, 2021 19:12
Basic jQuery
last 2 child add class
------------------------
$('ul.menu>li').slice(-2).addClass('last-elements');
lenth
---------
if ($(".active").length) {
$(".active").dropify();
}
@TeamBug99
TeamBug99 / Venobox awesome popups
Created September 22, 2021 19:12
Venobox awesome popups
https://github.com/nicolafranchini/VenoBox
@TeamBug99
TeamBug99 / Hover active and remove class
Created September 22, 2021 19:11
Hover active and remove class
// active
$('.pt-wrp').on('mouseenter', function () {
$(this).addClass('active').parent().siblings().find('.pt-wrp').removeClass('active');
})
@TeamBug99
TeamBug99 / Opacity on scroll
Created September 22, 2021 19:10
Opacity on scroll
var animation_start_pos = 0, animation_end_pos = 1000; //where you want the animation to stop
$(document).scroll(function() {
var scroll_pos = $(this).scrollTop();
var percentScrolled = parseFloat(scroll_pos/animation_end_pos);
jQuery('.people-opacity').css('opacity', percentScrolled );
});
html //
<div class="people-opacity" style="opacity: 0;"></div>