Правильное неразмытое подчёркивание ссылок в Сафари

$(function() { $('a').each(function(i, el) { if(isRetina()) { return; } linkOffsetTop = $(el).offset().top; linkBorderWidth = parseFloat($(el).css('border-bottom-width')); newBorderWidth = linkBorderWidth + (linkOffsetTop - parseInt(linkOffsetTop)); $(el).css({'border-bottom-width': newBorderWidth}) }); }); function isRetina(){ return ((window.matchMedia && (window.matchMedia('only screen and (min-resolution: 192dpi), only screen and (min-resolution: 2dppx), only screen and (min-resolution: 75.6dpcm)').matches || window.matchMedia('only screen and (-webkit-min-device-pixel-ratio: 2), only screen and (-o-min-device-pixel-ratio: 2/1), only screen and (min--moz-device-pixel-ratio: 2), only screen and (min-device-pixel-ratio: 2)').matches)) || (window.devicePixelRatio && window.devicePixelRatio > 2)) && /(iPad|iPhone|iPod)/g.test(navigator.userAgent); }
Автор — Дмитрий Дорошев. Оригинал: http://jsfiddle.net/mLt0b7wz/6/

1 Response

Please translate the russian text on CodePad, sharing in russian doesn't allow a good "accessibility" to others developpers :)

Write a comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.