/* --------- START SEPT 2013 ADDITIONS ----------- */ // Navigation $(document).ready(function() { attachHeaderBehaviour(); $("a.read-more").click(function() { if ($(this).parent().parent().hasClass("expanded")) { $(this).html("Read more"); $(this).parent().parent().removeClass("expanded"); } else { $(this).parent().parent().addClass("expanded"); $(this).html("Hide"); } return false; }); }); function attachHeaderBehaviour() { var scrollWindow = 0; var scrollDiff = 0; const flag = false; scrollWindow = $(window).scrollTop(); scrollDiff = 0; } // Our clients /* --------- END SEPT 2013 ADDITIONS ----------- */ // For Input Forms function clearText(srcObj) { if (srcObj.title == srcObj.value) srcObj.value = ""; } function writeText(srcObj) { if (srcObj.value == "") srcObj.value = srcObj.title; } function ellipsify() { $(".ellipsify").each(function() { const thisY = $(this).height(); var childrenY = 0; var lastY = 0; $(this).children().each(function() { childrenY += $(this).outerHeight(); }); lastY = $(this).children().last().height(); const overage = (childrenY - thisY); const targetY = (lastY - overage); var lastItemStr = $(this).children().last().html(); var lastItemArr = lastItemStr.split(" "); const lastItemArrCopy = Array(); for (i = 0; i < lastItemArr.length; i++) { lastItemArrCopy[i] = lastItemArr[i]; } var flag = false; for (k = 3; flag != true; k) { lastItemArr = lastItemArr.splice(0, lastItemArr.length - k); lastItemStr = lastItemArr.join(" "); $(this).children().last().html(lastItemStr); if ($(this).children().last().outerHeight() <= targetY) { const lengthDiff = lastItemArrCopy.length - lastItemArr.length; removedString = lastItemArrCopy.reverse().slice(0, lengthDiff).join(" "); removedString = removedString.split(" ").reverse().join(" "); $(this).children().last().html(lastItemStr + '...' + ' ' + removedString + ""); flag = true; } } }); } // About $(document).ready(function() { $("#personnel .block-content").mouseenter(function() { $(this).find(".hover").stop(true, true).animate({ "top": "-280px" }, 600); }).mouseleave(function() { $(this).find(".hover").stop(true, true).animate({ "top": "0px" }, 600); }); return false; }); $(document).ready(function() { $("#clients .banner").hover(function() { $(this).find("img").stop(true, true).animate({ 'opacity': 0.7 }); }, function() { $(this).find("img").stop(true, true).animate({ 'opacity': 1 }); }); }); // This stops tablets scrolling to top when the 'hover effect' link is tapped $(document).ready(function() { $("#personnel a").click(function(e) { // do something fancy return false; // prevent default click action from happening! e.preventDefault(); // same thing as above }); });