Skip to content

Instantly share code, notes, and snippets.

@LouisWhit
LouisWhit / Get Current Year
Created June 11, 2013 22:23
Lightweight get current year script.
<script type="text/javascript">
var d = new Date();
var y = d.getFullYear();
document.write(y);
</script>
@LouisWhit
LouisWhit / Mobile Current Year
Created June 11, 2013 22:49
Mobile friendly current year. This script plays nice with Jquery Mobile 1.31
<span class="year"></span>.
<script type="text/javascript">
$(".year").text((new Date).getFullYear());
</script>
@LouisWhit
LouisWhit / Columns Same Height.js
Last active December 18, 2015 15:39
Set columns to same height on one row. All columns will be height of tallest column.
var i = 0;
var maxHeight = 0;
for (var li = $("#equalHeight .box").length; i < li; i++) {
var currentHeight = $("#equalHeight .box:eq("+i+")").height();
if (currentHeight > maxHeight) {
maxHeight = currentHeight;
};
};
$("#equalHeight .box").height(maxHeight);
@LouisWhit
LouisWhit / Rand Image Numbers
Created June 25, 2013 16:42
Random background image script
<script type="text/javascript">
var numRand = Math.floor(Math.random()*4);
$('.rand-img').css('background-image', "url('{siteurl}assets/images/content-images/rotator/rotator-" + numRand + ".jpg')");
</script>
@LouisWhit
LouisWhit / Back to top - Basic.html
Last active April 16, 2019 18:56
Back to top - Basic footer link
<div class="returnTop"><p class="pull-right"><a href="#top"><i class="fa fa-arrow-up"></i></a></p></div>
@LouisWhit
LouisWhit / Dynamic FAQ Maker
Created July 11, 2013 12:59
Dynamic FAQ Maker - HTML has bootstrap tags in it. It is output after the DOM loads by JS that reads the page for h3 tags and dynamically creates the FAQ.
var ToC =
"<div class='well table-of-contents'>" +
"<h2>Question's List:</h2>" +
"<p>Click on any of the questions to go their corresponding answers below or you may just scroll down the page to find the answers you are looking for.</p>"+
"<ul>";
var newLine, el, title, link, id, i = 0;
$('.second-level-content .span8 h3').each(function(){
el = $(this);
title = el.text();
i = i+1;
@LouisWhit
LouisWhit / Social Share LinkedIn
Created August 12, 2013 13:16
Social Share: LinkedIn
<a href="http://www.linkedin.com/shareArticle?mini=true&url=[URL_Param]&title=[TITLE_Param]" target="_blank"><img src="/images/linkedin.gif" border="0" /></a>
@LouisWhit
LouisWhit / Social Share Twitter
Created August 12, 2013 13:17
Social Share: Twitter
<a href="http://twitter.com/home?status=[TITLE_Param] [URL_Param]" title="Click to send this page to Twitter" target="_blank"><img src="/images/twitter.gif" border="0" /></a>
@LouisWhit
LouisWhit / Social Share Facebook
Created August 12, 2013 13:18
Social Share: Facebook
<a name="fb_share" href="http://www.facebook.com/sharer.php?u=[URL_Param]&t=[TITLE_Param]" target="_blank"><img src="/images/facebook.gif" border="0" /></a>
@LouisWhit
LouisWhit / Social Share Add This
Created August 12, 2013 13:20
Social Share: Add This
<script type="text/javascript">addthis_pub = 'AddThis';</script>
<a href="http://www.addthis.com/bookmark.php" onmouseover="return addthis_open(this, '', '[URL]', '[TITLE]')" onmouseout="addthis_close()" onclick="return addthis_sendto()"><img src="http://s7.addthis.com/static/btn/lg-share-en.gif" width="125" height="16" border="0" alt="Share" /></a>
<script type="text/javascript" src="http://s7.addthis.com/js/200/addthis_widget.js"></script>