Change property css depending on the browser used

3

The following code should increase the space between the letters when it opens in safari but it seems to ignore the order that changes the css property even though the alert does. Thanks.

function BrowserDetection() {

    //Check if browser is IE or not
    if (navigator.userAgent.search("MSIE") >= 0) {
        alert("Browser is InternetExplorer");
    }
    //Check if browser is Chrome or not
    else if (navigator.userAgent.search("Chrome") >= 0) {
        alert("Browser is Chrome");
    }
    //Check if browser is Firefox or not
    else if (navigator.userAgent.search("Firefox") >= 0) {
        alert("Browser is FireFox");
    }
    //Check if browser is Safari or not
    else if (navigator.userAgent.search("Safari") >= 0 && navigator.userAgent.search("Chrome") < 0) {
		alert("Browser is Opera");
        $('#slogan').css('letter-spacing', '3px');
    }
    //Check if browser is Opera or not
    else if (navigator.userAgent.search("Opera") >= 0) {
        alert("Browser is Opera");
    }
}
BrowserDetection();
#slogan{
color:red; 
font-family: MonkGothic;
font-size:30px;
letter-spacing:1px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<pre id="slogan">
AA
AA
AA
AA
</pre>
    
asked by Ivan Soler 13.04.2016 в 23:56
source

1 answer

2

This is a bug, Safari does not work properly on the letter-spacing property:

link

link

link

In fact there is a question in English:

link

    
answered by 14.04.2016 / 02:08
source