Wednesday, August 31, 2016

Find Browser using Javascript

            // Opera 8.0+
            var isOpera = (!!window.opr && !!opr.addons) || !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0;
                // Firefox 1.0+
            var isFirefox = typeof InstallTrigger !== 'undefined';
                // At least Safari 3+: "[object HTMLElementConstructor]"
            var isSafari = Object.prototype.toString.call(window.HTMLElement).indexOf('Constructor') > 0;
                // Internet Explorer 6-11
            var isIE = /*@cc_on!@*/false || !!document.documentMode;
                // Edge 20+
            var isEdge = !isIE && !!window.StyleMedia;
                // Chrome 1+
            var isChrome = !!window.chrome && !!window.chrome.webstore;
                // Blink engine detection
            var isBlink = (isChrome || isOpera) && !!window.CSS;
       
         if(isIE)
         {
            setTimeout(function(){
            a = parseInt(jQuery('.masonary div:nth-child(6)').css('left'));
                jQuery('div[id^=masonary]:nth-child(5n),div[id^=masonary]:nth-child(6n),div[id^=masonary]:nth-child(7n)').each(function(){
                    reala = jQuery(this).css('left');
                    calca = parseInt(reala) + (a/2);
                    jQuery(this).css('left',calca);
                });
            }, 1000);
         }
         else
         {
            setTimeout(function(){jQuery('#masonary51').addClass('masonary51');},200);
         }

No comments:

Post a Comment