This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // function is triggered on resize and document ready | |
| $(window).on('resize',function() { | |
| var $elem = $('.my-checker-elem'); | |
| if ($elem.length && $elem.css('display') == 'none') { // or other CSS property | |
| // do something | |
| } else { | |
| // do something or not ... | |
| } | |
| }).trigger('resize'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function GetIEVersion() { | |
| var sAgent = window.navigator.userAgent; | |
| var Idx = sAgent.indexOf("MSIE"); | |
| // If IE, return version number. | |
| if (Idx > 0) | |
| return parseInt(sAgent.substring(Idx+ 5, sAgent.indexOf(".", Idx))); | |
| // If IE 11 then look for "Trident" in user agent string. | |
| else if (!!navigator.userAgent.match(/trident/gi)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // SVG Fallback to PNG with data-fallback="url-to-fallback-image.ext" | |
| if(!Modernizr.svg) { | |
| var imgs = $('img[data-fallback]'); | |
| imgs.attr('src', imgs.data('fallback')); | |
| } | |
| // SVG Fallback to pngs by the same name | |
| if (!Modernizr.svg) { | |
| var imgs = document.getElementsByTagName('img'); | |
| var svgExtension = /.*\.svg$/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Dynamic Back-to-Top Link Button | |
| var offset = 350, | |
| duration = 600, | |
| btt = $('#back-to-top'); | |
| $(window).scroll(function() { | |
| if(btt.css("position") !== "static") { | |
| if ($(this).scrollTop() > offset) { | |
| btt.fadeIn(duration); | |
| } else { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Animated local links | |
| var lnks = $("a[href*=#]"); | |
| lnks.click(function(e) { | |
| e.preventDefault(); | |
| var offs = $($(this).attr('href')).offset().top; | |
| $('html, body').animate({scrollTop:offs}, 600); | |
| $(this).blur(); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* Use .msie-overflow { | |
| -ms-overflow-style: scrollbar; | |
| } | |
| on the outer created DIV. */ | |
| function getScrollbarWidth() { | |
| var outer = document.createElement("div"); | |
| outer.style.visibility = "hidden"; | |
| outer.style.width = "100px"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var toggler = function(element, open, closing) { | |
| var b = element; | |
| if(b.hasClass(open)) { | |
| b.addClass(closing); | |
| b.one('webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend', | |
| function(e) { | |
| b.removeClass(closing); | |
| }); | |
| } |