main.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /* Make header image fade properly when it's height is bigger than it's container */
  2. $(window).resize(function() {
  3. fixHeaderTransparency();
  4. });
  5. var waitForFinalEvent = (function () {
  6. var timers = {};
  7. return function (callback, ms, uniqueId) {
  8. if (!uniqueId) {
  9. uniqueId = "Don't call this twice without a uniqueId";
  10. }
  11. if (timers[uniqueId]) {
  12. clearTimeout (timers[uniqueId]);
  13. }
  14. timers[uniqueId] = setTimeout(callback, ms);
  15. };
  16. })();
  17. function fixHeaderTransparency() {
  18. waitForFinalEvent(function(){
  19. var headerImage = document.getElementById('headerImage');
  20. if (headerImage.clientHeight > 500) {
  21. headerImage.style['-webkit-mask-image'] = "linear-gradient(to bottom, rgba(0,0,0,1) 40px, rgba(0,0,0,0) 450px)";
  22. }
  23. else {
  24. headerImage.style['-webkit-mask-image'] = "linear-gradient(to bottom, rgba(0,0,0,1) 40px, rgba(0,0,0,0) 90%)";
  25. }
  26. }, 25, "FadingHeaderResize");
  27. }
  28. $(document).ready(function() {
  29. $(".tooltip").tooltipster({
  30. contentCloning: true,
  31. theme: 'tooltipster-punk',
  32. functionReady: function(){
  33. var offset = $(this).offset();
  34. $(".tooltipster-base").offset(offset);
  35. },
  36. });
  37. $(".tooltip").tooltipster();
  38. $.tooltipster.group("tooltip");
  39. fixHeaderTransparency();
  40. });