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 / code-block.js
Created November 27, 2020 00:07
When video ends inside carousel, force carousel to move and start next video
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 / style.css
Created December 3, 2020 07:06
Make offcanvas appear from bottom of page, with custom width. (set offcanvas to slide from left or right, so you have access to the width control)
/* replace #-off-canvas-3-450 with your offcanvas ID */
#-off-canvas-3-450 .offcanvas-inner {
left: 50%;
}
#-off-canvas-3-450 .offcanvas-inner.oxy-inner-content {
transform: translate(-50%,100%);
-webkit-transform: translate(-50%,100%);
display: block; /* depending on form, to prevent flex overflow issues */
@wplit
wplit / style.css
Last active December 3, 2020 23:04
add psuedo element over header row to create the illusion of the dropdowns being underneath the header
/* Replace header row ID for your header row ID with the mega menu inside
You will also need to increase the z-index manually of any other elements inside the header
that isn't the mega menu, logos, burger, header search, everything to make them visible.
*/
#_header_row-6-248 {
position: relative;
}
#_header_row-6-248::after {
@wplit
wplit / plugin.php
Last active December 14, 2020 02:31
function for 'PHP function return value' when using image component inside flickity
/*
*
* Attribute name: data-flickity-lazyload-srcset
* Attribute value: PHP function return value -
* function name: flickityLazySRCSET
* function args: $field_name,$size
*/
function flickityLazySRCSET($field_name,$size) {
$image = get_field($field_name);
@wplit
wplit / offcanvas.css
Created December 15, 2020 03:00
showing a certain part of the offcanvas while it's still closed, for displaying icons etc.
/* Change the ID to match your offcanvas ID */
#-off-canvas-558-275:not(.oxy-off-canvas-toggled) .offcanvas-inner {
--offcanvas-visible: 105px; /* Change this to width you want visible */
-webkit-transform: translate(calc(-100% + var(--offcanvas-visible)),0);
-ms-transform: translate(calc(-100% + var(--offcanvas-visible)),0);
transform: translate(calc(-100% + var(--offcanvas-visible)),0);
}
@wplit
wplit / condition.php
Created December 16, 2020 03:50
user registration date
<?php
if ( function_exists( 'oxygen_vsb_register_condition' ) ) {
oxygen_vsb_register_condition(
'User Registration',
array('custom' => true, 'placeholder' => 'MM/DD/YYYY'),
@wplit
wplit / style.css
Last active January 1, 2021 06:37
megamenu inside sticky header, scrollable
.oxy-sticky-header-active .oxy-mega-menu {
background: none!important;
}
.oxy-sticky-header-active .oxy-mega-dropdown {
background-color: var(--megamenu-responsive-background);
}
@media (max-width: 991px) { /* Change to screen width of your mobile menu */
@wplit
wplit / code-block.php
Created January 14, 2021 01:57
code-block for custom acf gallery
<?php
$images = get_field('my_gallery');
$size = 'large';
if( $images ): ?>
<ul class="cell-container">
<?php foreach( $images as $image ): ?>
<li class="cell">
<div class="cell-inner">
@wplit
wplit / code-block.css
Last active January 14, 2021 02:04
code-block for custom acf gallery
.oxy-carousel-builder .cell-container{
display: flex;
margin: 0;
padding: 0;
}
.oxy-carousel-builder .cell {
list-style-type: none;
}
@wplit
wplit / a.js
Created January 14, 2021 23:24
force carousel builder to continue playing after user interaction (add to carousel builder > advanced > javascript
jQuery(document).ready(function($) {
let $carousel = $('#%%ELEMENT_ID%%').find($('#%%ELEMENT_ID%%').children().data('carousel'));
$carousel.on('pointerUp.flickity', function(event, pointer) {
$carousel.flickity('playPlayer');
});