Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
I may be slow to respond.

David Browne wplit

💭
I may be slow to respond.
View GitHub Profile
@wplit
wplit / code-block.js
Created Nov 27, 2020
When video ends inside carousel, force carousel to move and start next video
View code-block.js
jQuery(document).ready(function($) {
var myFlickity = Flickity.data('.my-carousel .oxy-inner-content');
var MediaPlayers = $('vime-player');
MediaPlayers.each(function() {
var nextMedia = $(this).parent('.oxy-pro-media-player').next('.oxy-pro-media-player').find('vime-player')[0];
var eachMedia = $(this)[0];
@wplit
wplit / codeblock.js
Created Nov 24, 2020
resize carousel when font size switch clicked.
View codeblock.js
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);
});
});
@wplit
wplit / pro-media-player.js
Last active Nov 20, 2020
pro media player, adding params manually on the youtube embed eg.. 'enablejsapi=1&controls=0&autoplay=1&rel=0'
View pro-media-player.js
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 / code-block.js
Created Nov 15, 2020
allow hashlink inside one offcanvas make sure the second one is also closed
View code-block.js
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 / code-block.js
Last active Nov 1, 2020
hide a load more button if no next pagination link found
View code-block.js
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 / stylesheet.css
Last active Oct 29, 2020
expanding search using header search component
View stylesheet.css
/* 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 Oct 27, 2020
link to accordion item inside Pro Accordion component (when using acf repeaters) with hashlink from another page
View code-block.js
/*
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 / code-block.js
Last active Oct 27, 2020
link to accordion item inside Pro Accordion component with hashlink from another page
View code-block.js
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 / style.css
Created Oct 14, 2020
adding fade effect to carousel builder
View style.css
/*
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 / style.css
Last active Oct 7, 2020
Make offcanvas fade instead of slide
View style.css
.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);
}
You can’t perform that action at this time.