CodeScrolling

Add Class when Element scrolls into View

function isScrolledIntoView(elem) {
  if (elem.length) {
	var docViewTop = $(window).scrollTop();
	var docViewBottom = docViewTop + $(window).height();
        var elemTop = $(elem).offset().top - 300;
	var elemBottom = elemTop + $(elem).height();

	return ((elemBottom <= docViewBottom) && (elemTop >= docViewTop));
   }
}

if (isScrolledIntoView($('.site-footer'))) {
   $('body').addClass('footer-visible');
} else {				 
   $('body').removeClass('footer-visible');
}

ShopifyCodeShopify Code

How to add fonts to a Shopify site

Make it a fonts.scss.liquid and then add {{ ‘fonts.scss.css’ | asset_url | stylesheet_tag }} to theme.liquid

Example of formatting:

@font-face {
    font-family: 'BeausiteGrandThin';
    src: url('BeausiteGrandThin.eot');
    src: url('BeausiteGrandThin.eot') format('embedded-opentype'),
         url('BeausiteGrandThin.woff2') format('woff2'),
         url('BeausiteGrandThin.woff') format('woff'),
         url('BeausiteGrandThin.ttf') format('truetype'),
         url('BeausiteGrandThin.svg#BeausiteGrandThin') format('svg');
}

Code

Search Results by Relevance instead of Post Date

add_filter('relevanssi_orderby', 'rlv_fix_order');
function rlv_fix_order($orderby) {
    $orderby = "relevance";
    return $orderby;
}

Code

Screenshots to be JPG instead of PNG

Type into Terminal:

defaults write com.apple.screencapture type jpg;killall SystemUIServer

Code

Email Signature

<table style="font-size: 12.8px; font-family: times;">
<tbody><tr><td><a href="http://mckenziesuemakes.com/" target="_blank">
<img src="http://mckenziesue.engine.com/wp-content/themes/mckenziesue-basetheme/img/[email protected]" width="250&quot;" style="float: left; padding-right: 15px; padding-bottom: 15px;"></a>
<p style="padding-left: 0px; margin-top: 0px; font-family: lato, sans-serif; margin-bottom: 0px; font-size: 7px; letter-spacing: 1px;"><a style="color: black;">MCKENZIE SUE RUCKER<br>
<br>PH: 509.855.2557<br><br>[email protected]</a></p></td></tr></tbody></table>

Code

If WordPress max file-size is too low

*Caution: You should not edit this file if you are not confident in the code. You shouldn’t really change the upload_max_filesize for purposes other than importing.

 

For wordpress upload go to /etc/php5/apache2
Vim php.ini
Search for upload_max_filesize and post_max_size by writing / before the word.
Instead of copying the wording just change the number.
Do sudo service apache2 restart.

Code

_____@_______.com.test-google-a.com

When Contact Form 7 does not send to a Gmail email for some reason, add .test-google-a.com to the end and it may help. I learned this trick from a Google support agent and it has worked every time. You will want to also download the ‘Contact Form 7 Submissions’ to make sure any submissions don’t get lost between your site and your email inbox.

Code

Smooth Scroll Link

$(".smooth-scroll-link").click(function() {
that = this;

var href = $.attr(that, 'href');
  if (href != '#' && href != '') {
    var target = $(href);
    $('html, body').animate({
       scrollTop: target.offset().top
    }, 1000);
  }
});

Code

Scroll to bottom of Page

$(window).scroll(function(){
if ($(window).scrollTop() == $(document).height()-$(window).height()){
    //Add Javascript
}
});

Code

Hide Pinterest Link once you hit the bottom of site

// Hide Pinterest Link
if (docScroll > ($(document).height() - $(window).height() - 100)) {
  $('._____').addClass('hidden');
    } else {
  $('._____').removeClass('hidden');
}