Skip to content

Instantly share code, notes, and snippets.

View curtiswilkinson's full-sized avatar

Curtis Tate Wilkinson curtiswilkinson

View GitHub Profile
@curtiswilkinson
curtiswilkinson / gist:6d1affc22422a7b19f2d
Created August 22, 2015 07:51
Hiding DOM element base on day of the week/hour of day
$(document).ready(function () {
var d = new Date();
var dayOfWeek = d.getDay()
var hour = d.getHours();
if (dayOfWeek === 1 || dayOfWeek === 2 || dayOfWeek === 3) {
$('.element').show();
}
if (dayOfWeek === 4 && hour < 13) {
$('.element').show();
@curtiswilkinson
curtiswilkinson / custom.js
Last active December 14, 2015 22:58
Jquery slideToggle() accordion style menus
$(document).ready(function() {
$('.price-range-lg').hide();
$('.price-range').hide();
$('.filter').css('display','none');
$('.filter-remove').each(function(){
var showfilters = $(this).attr('data-filtercode');
$('.filter-title[data-filtercode="'+showfilters+'"]').click();
});
});
$('.filter-title').click(function(){
@curtiswilkinson
curtiswilkinson / sidebar.template.html
Created September 30, 2015 05:13
Setting up a filter for a custom content type
<!--##[%PRODUCT_FILTER type:'compat' compatlist:'dietary' limit:'100' autohide:'0'%]
[%PARAM header%]##-->
<li class="nav-sub-header muted">
Filter by Dietary
</li>
<!--##[%END PARAM%]
[%PARAM *body_title%]##-->
<!--##[%END PARAM%]
[%PARAM *body%]##-->
<li class="lv[@level@]">
@curtiswilkinson
curtiswilkinson / onepage.template.html
Created October 1, 2015 06:42
Remove all non-numerical values from fields
<script type="text/javascript">
$("#bill_phone, #ship_phone").keyup(function () {
this.value = this.value.replace(/[^0-9\.]/g,'');
});
</script>
@curtiswilkinson
curtiswilkinson / template.html
Created October 8, 2015 23:18
Half-star review ratings
[%SET [@ratings-count@] %][@rating_round_half@] [%/set%]
[%set [@ratings-count@] %][%split delimiter:'-'%]
[%param data1%][@ratings-count@][%/param%]
[%param *body%]
[%if [@count@] ne '0' %].[%/if%][@data1@]
[%/param%]
[%/split%][%/set%]
[%set [@ratings-count-while@] %][@ratings-count@][%/set%]
[%WHILE [@ratings-count-while@] > 0 %]
@curtiswilkinson
curtiswilkinson / template.html
Created October 12, 2015 02:49
Making a field mandatory before adding to cart using the "disabled" class on the add to cart button by default
<script type="text/javascript">
if ($('#productextra0').length) {
$('#productextra0').keyup(function(){
if ($('#productextra0').val() != '') {
$('.addtocart').removeClass('disabled');
}
else {
$('.addtocart').addClass('disabled');
}
});
@curtiswilkinson
curtiswilkinson / template.html
Created October 15, 2015 02:24
Use Anchor element to open and soft scroll to TAB
<a onclick="$('a[href=#reviews]').tab('show'); $('html,body').animate({scrollTop:$('a[href=#reviews]').offset().top}, 600); return false;" data-toggle="tab">
Read Reviews
</a>
@curtiswilkinson
curtiswilkinson / header.template.html
Created October 15, 2015 23:22
Content (brand) URL on product page
[%CONTENT_PATH id:'[@inventory_id@]' type:'brand' limit:'1'%][%PARAM *body%]
<a class="product-brand" href="[%url type:'cms'%][%PARAM id%][@content_id@][%END PARAM%][%/ url%]">[@content_name@]</a>
[%END PARAM%][%END CONTENT_PATH%]
@curtiswilkinson
curtiswilkinson / custom.js
Created October 19, 2015 00:12
breakpoint in Zoom JS (to prevent mobile issues)
$(document).ready(function(){
if (window.screen.width > 767) {
$('.zoom').zoom();
}
});
@curtiswilkinson
curtiswilkinson / style.css
Created October 21, 2015 04:25
media queries for thumb rows of 5
@media (min-width:1200px) {
.home-thumb {
width:20%;
float:left;
}
}
@media (min-width:992px) and (max-width:1199px) {
.home-thumb {
width:25%;
float:left;