JSFiddle - React, Tailwind, and code Playground

by Peter Doyle

HTML

<div class="allbrowsers">
    <p>This is the content of the div</p>
    <a>this an a</a>
</div>

CSS

.allbrowsers p{ padding:80px; background:red; color:#fff; }
.allbrowsers a{ padding:80px; background:red; color:#fff;  }

.internetExplorer p{ padding:80px; background:blue; color:#fff; }
.internetExplorer a{ padding:80px; background:blue; color:#fff; }

JavaScript

////////////////////////////////////////////// Tiles
$(function(){
    
    // Gets version number of ie
    var ieVersion = getInternetExplorerVersion();
    
   //alert(ieVersion)
    
    //test if ie version is over 0
    if( ieVersion > 0 ){
        // swap class of .allbrowsers to make it .internetExplorer
        $(".allbrowsers").addClass("internetExplorer").removeClass("allbrowsers");
        
        // calls animations for IE
        animateBoxesIE();
        
    }else{
        // calls animations for real browsers
        animateBoxes();
    }

})

function animateBoxes(){
// all ie js

}

function animateBoxesIE(){
// all ie js

}





//////////////////////////////////////////////// GLOBAL
//Check version Of internet explorer
function getInternetExplorerVersion(){
  var rv = -1;
    
  if (navigator.appName == 'Microsoft Internet Explorer'){
    var ua = navigator.userAgent;
    var re  = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
    if (re.exec(ua) != null)
      rv = parseFloat( RegExp.$1 );
  }else if (navigator.appName == 'Netscape'){
    var ua = navigator.userAgent;
    var re  = new RegExp("Trident/.*rv:([0-9]{1,}[\.0-9]{0,})");
    if (re.exec(ua) != null)
      rv = parseFloat( RegExp.$1 );
  }
    
  return rv;
}