Skip to content

Instantly share code, notes, and snippets.

View wplit's full-sized avatar
💭
I may be slow to respond.

David Browne wplit

💭
I may be slow to respond.
View GitHub Profile
@wplit
wplit / header-search.js
Created October 7, 2020 04:12
empty header search after each search
jQuery(document).ready(function($) {
$('#%%ELEMENT_ID%%').find('.oxy-header-search_search-field').attr( "value", "" );
});
@wplit
wplit / style.css
Last active October 7, 2020 22:35
Make offcanvas fade instead of slide
.oxy-off-canvas .offcanvas-inner {
-ms-transform: none;
transform: none;
-webkit-transform: none;
visibility: hidden;
opacity: 0;
-webkit-transition: all .5s cubic-bezier(0.77,0,0.175,1);
-o-transition: all .5s cubic-bezier(0.77,0,0.175,1);
transition: all .5s cubic-bezier(0.77,0,0.175,1);
}
@wplit
wplit / style.css
Created October 14, 2020 00:19
adding fade effect to carousel builder
/*
Make sure to change the ID to the ID of the carousel builder.
(or if multiple of use a class)
Also, replace .oxy-post with the class of the cell. For eg, if using repeater, use '.ct-dynamic-list > .ct-div-block'
or if using Woocommerce use.. 'ul.products .product'
*/
#-carousel-builder-372-6 .flickity-slider {
transform: none !important;
@wplit
wplit / code-block.js
Last active October 27, 2020 08:11
link to accordion item inside Pro Accordion component with hashlink from another page
jQuery(document).ready(function($) {
// open the accordion if hash link
var hash = window.location.hash;
if (hash) {
var element = $(hash);
setTimeout(function() {
// Only if element is found and is part of a Pro Accordion item
@wplit
wplit / code-block.js
Last active October 27, 2020 08:52
link to accordion item inside Pro Accordion component (when using acf repeaters) with hashlink from another page
/*
With this you can customise the ID of the accordion in dynamic mode.. say it's #pricing-faq
Then to link to the 3rd item in that accordion, it would be example.com/#pricing-faq-3
Change the 1000ms, to whatever delay you need for opening the accordion and scrolling
*/
jQuery(document).ready(function($) {
var hash = window.location.hash.substr(1);
if (hash !== '') {
@wplit
wplit / stylesheet.css
Last active October 29, 2020 23:20
expanding search using header search component
/* Change ID to your component */
.oxy-header-search {
position: relative;
width: 200px;
}
#-header-search-163-271 .oxy-header-search_form {
position: absolute;
width: 0;
@wplit
wplit / code-block.js
Last active November 1, 2020 23:20
hide a load more button if no next pagination link found
jQuery(document).ready(function($) {
let loadMoreSelector = '.load-more'; // change to load more button selector
if (!$('.oxy-infinite-scroller').find('.next').length) {
$(loadMoreSelector).hide();
}
@wplit
wplit / code-block.js
Created November 15, 2020 23:27
allow hashlink inside one offcanvas make sure the second one is also closed
jQuery(document).ready(function($) {
// Change these selectors to match the class or ID of your offcanvas elements
let mainOffcanvas = '.main-offcanvas',
secondOffcanvas = '.second-offcanvas';
// Make sure second offcanvas is closed
$(mainOffcanvas).find('a[href*=\\#]').not(".menu-item-has-children > a").on('click', function(e) {
e.stopPropagation();
@wplit
wplit / pro-media-player.js
Last active November 20, 2020 13:57
pro media player, adding params manually on the youtube embed eg.. 'enablejsapi=1&controls=0&autoplay=1&rel=0'
document.querySelector('#%%ELEMENT_ID%% vime-player').addEventListener('vPlaybackReady', (event) => {
const embed = document.querySelector('#%%ELEMENT_ID%% vime-embed');
// Don't remove the enablejsapi=1 as the player needs it
embed.params = 'enablejsapi=1&controls=0';
});
@wplit
wplit / codeblock.js
Created November 24, 2020 00:55
resize carousel when font size switch clicked.
jQuery(document).ready(function($) {
var myflkty = Flickity.data('.flickity-enabled'); // get flickity
$( ".acwp-switcher" ).on( "click", function() {. // listen for clicking the font size switches
setTimeout(function() {
myflkty.resize(); // wait 100ms, then resize the carousel
}, 100);
});
});