Skip to content

Instantly share code, notes, and snippets.

View re-dev's full-sized avatar

Vaughan James re-dev

View GitHub Profile
@re-dev
re-dev / jquery.smooth-scroll.js
Last active August 8, 2018 16:45
jQuery Smooth Scrolling Anchor Links
// Select all links with hashes
$('a[href*="#"]')
// Remove links that don't actually link to anything
.not('[href="#"]')
.not('[href="#0"]')
.click(function(event) {
// On-page links
if (
location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '')
&&
<script>
var getUrlParameter = function getUrlParameter(sParam) {
var sPageURL = decodeURIComponent(window.location.search.substring(1)),
sURLVariables = sPageURL.split('&'),
sParameterName,
i;
for (i = 0; i < sURLVariables.length; i++) {
sParameterName = sURLVariables[i].split('=');
@re-dev
re-dev / ss-slideshow-interval-delay
Created August 27, 2017 03:16
Change Squarespace Slideshow Delay
<script>
window.oldSetTimeout = window.setTimeout;
window.setTimeout = function(code, delay) {
if (delay == 5000) {
delay = 7000;
}
var retval = window.oldSetTimeout(code, delay);
return retval;
};
window.oldSetInterval = window.setInterval;
@re-dev
re-dev / ss-confirm-redirect
Last active August 27, 2017 03:18
Customising a Squarespace Checkout Confirmation Page and Redirect
<script>
var insertThis = "<h1>Thank you, your order is confirmed.</h1><p>Order Number: <strong>#000{orderId}</strong></p><p>Thank you for your order! Your payment of <strong>${orderGrandTotal}</strong> has been confirmed. A confirmation email has been sent to you at <a href='mailto:{customerEmailAddress}'>{customerEmailAddress}</a>.</p>"
$("#confirmed-page").after(insertThis).css("display","none");
$(document).ready(function() {
// redirect based on order value
var whichPackage = {orderGrandTotal}
setTimeout(function(){
if(whichPackage > 1000 ){