Skip to content

Instantly share code, notes, and snippets.

@jbd91
jbd91 / snippet.js
Created September 16, 2019 16:20
jQuery Zoom Repeater Field printing multiple images
// Specify array value so only the image for that row is printed. Also need to define URL as image field returns array of options.
jQuery(document).ready(function($){
$('.ti--modal-image').zoom({url: '<?php echo $ti_modal_image['0']['url']; ?>'});
});
@jbd91
jbd91 / snippet.scss
Created September 16, 2019 15:26
Hide Slick dots if > 1 slide
.slick-dots {
> li {
display: inline-block;
}
> li:only-child {
display: none;
}
}
@jbd91
jbd91 / snippet.scss
Last active September 16, 2019 15:39
Modal Scrolling to Top of Page (Avada/Bootstrap)
// Also make sure to remove # value form href="" attribute
.ua-mobile .modal-open {
position: relative !important;
}
@jbd91
jbd91 / snippet.js
Created September 16, 2019 15:08
jQuery Focus example
// On click focus element, integrated with the funcitonality to render hidden slick slider.
$('a[data-toggle="tab"]').click(function () {
setTimeout(function () {
$('.grid--map-mobile-slider').slick('setPosition');
}, 200);
$(this).first().focus();
@jbd91
jbd91 / snippet.scss
Last active September 14, 2019 19:25
Custom Gravity form Radio buttons
input[type=radio] label {
position: relative;
cursor: pointer;
}
input[type=radio] + label:before {
content: '';
display: inline-block;
width: 34px;
height: 34px;
@jbd91
jbd91 / snippet.js
Created September 13, 2019 20:20
Stop YT video sounds after modal closed
// This was originally for a bootstrap modal
$(document).ready(function(){
$('.modal').each(function(){
var src = $(this).find('iframe').attr('src');
$(this).on('click', function(){
$(this).find('iframe').attr('src', '');
@jbd91
jbd91 / snippet.js
Created September 11, 2019 16:32
Media Query JS
var mq = window.matchMedia( "(max-width: 570px)" );
if (mq.matches) {
// window width is at less than 570px
}
@jbd91
jbd91 / snippet.js
Created September 11, 2019 16:13
Init slick slider hidden in Tab
$( 'a[data-toggle="tab"]' ).click(function() {
setTimeout(function(){
$('.grid--map-mobile-slider').slick('setPosition');
},200);
});
@jbd91
jbd91 / snippet.js
Created August 19, 2019 16:07
Detect Query String and append to iframe src Solution 2
if ($("body").hasClass("page-id-3421")) {
if (document.location.search.length) {
document.getElementById('impactMap').src = 'https://www.abodo.com/search-widget?' + window.location.search;
} else {
document.getElementById('impactMap').src = 'https://www.abodo.com/search-widget';
}
}
@jbd91
jbd91 / snippet.php
Created August 1, 2019 15:34
Formatted print_r
<?php
// debug
echo '<h3>Array of $terms (debug)</h3>';
print '<pre>';
print_r($terms);
print '</pre>';
?>