Skip to content

Instantly share code, notes, and snippets.

*,
*::before,
*::after {
box-sizing: border-box;
}
select {
/* A reset of styles, including removing the default dropdown arrow*/
appearance: none;
-webkit-appearance: none;
@dislokacia
dislokacia / JetMenu revamp horizontal scroll
Last active June 27, 2022 13:13
JetMenu revamp horizontal scroll
jQuery(document).ready(function( $ ){
var offsetX = {};
$('.jet-mega-menu-item--mega').each(function(index) {
offsetX[index] = $(this).find('.jet-mega-menu-mega-container__inner').css('-webkit-transform').split(/[()]/)[1];
$(this).find('.jet-mega-menu-mega-container').css('left', `${offsetX[index].split(',')[4]}px`);
$(this).find('.jet-mega-menu-mega-container__inner').css({
'left' : `${-offsetX[index].split(',')[4]}px`,
'position' : 'relative',
})
})
@dislokacia
dislokacia / JetSmartFilters indexer doesn't hide the margins from empty columns
Last active May 28, 2022 12:37
JetSmartFilters indexer doesn't hide the margins from empty columns
jQuery(document).ready(function( $ ){
//on page load remove margins for the hidden filters
$( '.jet-filter:hidden').closest('.elementor-element').addClass('hide_margin');
//on applying the filters add the class to the hidden filters to remove the margins
$( document ).on( 'jet-filter-content-rendered', function() {
setTimeout(function() {
$( '.jet-filter:hidden').closest('.elementor-element').addClass('hide_margin');
}, 100);
});
@dislokacia
dislokacia / Hide Listing Grid widget before filtering
Created May 28, 2022 12:39
Hide Listing Grid widget before filtering
jQuery(document).ready(function( $ ){
$( document ).on( 'jet-filter-content-rendered', function() {
$( '.hide-listing').removeClass('hide-listing');
});
});
@dislokacia
dislokacia / JetEngine macros to get the value of the Cookie by name
Last active June 10, 2022 13:06
JetEngine macros to get the value of the Cookie by name
@dislokacia
dislokacia / Hide element, if there are no products in the cart (with Ajax events )
Created June 10, 2022 12:49
Hide element, if there are no products in the cart (with Ajax events )
jQuery(document).ready(function( $ ){
$( document ).ajaxComplete(function() {
if (!Cookies.get('woocommerce_items_in_cart')) {
$('.empty_message').show();
} else {
$('.empty_message').hide();
}
});
if (!Cookies.get('woocommerce_items_in_cart')) {
$('.empty_message').show();
@dislokacia
dislokacia / Password visibility JetFormBuilder.js
Last active May 3, 2024 10:54
Password visibility JetFormBuilder
jQuery(document).ready(function( $ ){
$('.jet-form-builder input[type="password"]').each(function(){
let id = $(this).attr('id');
if($(this).length>0){
$(this).closest('div').append(`<label><input class="pass_vis" style="display:none;" type="checkbox" onclick="myFunction('${id}')"><i class="vis-icon fa fa-solid fa-eye"></i></label>`);
let offset = ($(this)[0].clientHeight - $('.vis-icon')[0].clientHeight)/2;
$(this).closest('div').css('position', 'relative');
$(this).siblings().css({
'position' : 'absolute',
'right' : '20px',
@dislokacia
dislokacia / text_after_upload.js
Created July 1, 2022 08:06
JetEngine media field text after upload
jQuery(document).ready(function( $ ){
$('.jet-engine-file-upload__fields').each(function(index){
let upload = $(this).find('.jet-engine-file-upload__input');
$(this).append('<input type="button" class="addfile" value="Choose file"/>');
$(this).append('<label class="labeladdfile">Choose file</label></div>');
let labelAdd = $(this).find('.labeladdfile');
let buttonAdd = $(this).find('.addfile');
let uploadValue = $(this).find('.jet-engine-file-upload__value');
$(this).find('.jet-engine-file-upload__input').css('display','none');
$(this).find('.addfile').click(function () {
@dislokacia
dislokacia / text_after_upload.js
Last active April 30, 2023 00:21
JetFormbuilder media field text after upload
jQuery(document).ready(function( $ ){
$('.jet-form-builder-file-upload__fields').each(function(index){
let upload = $(this).find('.jet-form-builder-file-upload__input');
$(this).append('<input type="button" class="addfile" value="Choose file"/>');
$(this).append('<label class="labeladdfile">Choose file</label></div>');
let labelAdd = $(this).find('.labeladdfile');
let buttonAdd = $(this).find('.addfile');
let uploadValue = $(this).find('.jet-form-builder-file-upload__files');
upload.css('display','none');
$(this).find('.addfile').click(function () {
@dislokacia
dislokacia / script.js
Created July 7, 2022 21:05
JetSearch with empty input and checked category
jQuery(document).ready(function( $ ){
$('.jet-ajax-search__submit').on('click',function(){
$('.jet-ajax-search__form').submit();
})
$(".jet-ajax-search__submit").on('keyup', function (e) {
if (e.key === 'Enter' || e.keyCode === 13) {
$('.jet-ajax-search__form').submit();
}
});
});