Skip to content

Instantly share code, notes, and snippets.

View softiconic's full-sized avatar

Softiconic softiconic

View GitHub Profile
@softiconic
softiconic / Shopify Footer Link list title
Last active December 2, 2023 18:56
Title for a list of links in the footer on a Shopify website.
@softiconic
softiconic / CSS file
Last active December 2, 2023 18:56
Social icon with a fixed position on both desktop and mobile devices.
.scfloatPC {
right: 0;
position: fixed;
top: 50%;
transform: translateY(-50%);
z-index: 999;
text-align: center;
}
.scfloatPC a {
display: block;
@softiconic
softiconic / HTML file
Created May 5, 2020 09:34
Only text Slider
<h1 id="changingtext">We Are <span>Digital </span>Marketing.</h1>
@softiconic
softiconic / gist:07a3cc4b12a815bbe9c47e7f3b6f42eb
Last active December 2, 2023 18:56
Defer the JavaScript execution in the function file.
//defer js
function defer_parsing_of_js($url)
{
if (is_admin()) return $url;
if (false === strpos($url, '.js')) return $url;
if (strpos($url, 'jquery.js')) return $url;
if (strpos($url, ' js-mini.js')) return $url;
return str_replace(' src', ' defer src', $url);
}
@softiconic
softiconic / function.php
Last active December 2, 2023 18:57
Remove the company name field from the WooCommerce checkout page.
//remove company name
add_filter( 'woocommerce_checkout_fields' , 'remove_company_name' );
function remove_company_name( $fields ) {
unset($fields['billing']['billing_company']);
return $fields;
}
@softiconic
softiconic / custom.js
Last active December 2, 2023 18:57
JavaScript for activating tabs.
$(function() {
var $a = $(".tabs li");
$a.click(function() {
$a.removeClass("active");
$(this).addClass("active");
});
});
@softiconic
softiconic / gist:eb43d0e17cdc17645351422a344384be
Last active December 2, 2023 18:57
Script for a navigation menu.
$('.dropdown-menu a.dropdown-toggle').on('click', function(e) {
if (!$(this).next().hasClass('show')) {
$(this).parents('.dropdown-menu').first().find('.show').removeClass("show");
}
var $subMenu = $(this).next(".dropdown-menu");
$subMenu.toggleClass('show');
$(this).parents('li.nav-item.dropdown.show').on('hidden.bs.dropdown', function(e) {
$('.dropdown-submenu .show').removeClass("show");
});
@softiconic
softiconic / gist:5b0e31a5cd36b61e5a8475797f8b0358
Last active December 2, 2023 18:58
Fixed header that remains sticky as you scroll.
//**********Sticky Header**********
$(window).on('scroll', function (){
var sticky = $('header'),
scroll = $(window).scrollTop();
if (scroll >= 100) sticky.addClass('sticky');
else sticky.removeClass('sticky');
});
@softiconic
softiconic / custom.js
Last active October 29, 2024 04:31
JavaScript for scrolling through pages or sections.
$(document).ready(function() {
// Define the offset
var offset = -200; // Adjust this value as needed
// Function to scroll to the target with offset
function scrollToTarget(target) {
$('html, body').animate({
scrollTop: target.offset().top + offset
}, 1000);
}
@softiconic
softiconic / custom.js
Last active December 2, 2023 18:58
Convert an image source (img src) into a background image using a combination of script and CSS.
//Replace carousel images into background images.
$('#carousel .item img').each(function() {
var imgSrc = $(this).attr('src');
$(this).parent().css({'background-image': 'url('+imgSrc+')'});
$(this).remove();
});