JSFiddle - React, Tailwind, and code Playground

by Wentz Wu

HTML

<a class="link depth-0" href="javascript:doLogin();" style="-webkit-tap-highlight-color: rgba(0, 0, 0, 0);"><span class="indent-0"></span>登入</a>
<div id="result"></div>

CSS

[href*='javascript:doLogin'][class~='link'] {
    background-color:red;
}

JavaScript

alert((2592 / 2.41));
var test = new Test();
var r = test.newSize(2592,1728,768,320,true);
$("#result").text(r.width + "," + r.height);
  
function Test() {
    this.newSize = function (w, h, W, H, C) {
        if ((W && w > W) || (H && h > H)) {
            var r = w / h;
            if ((r >= 1 || H === 0) && W && !C) {
                w = W;
                h = (W / r) >> 0;
            } else if (C && r <= (W / H)) {
                w = W;
                h = (W / r) >> 0;
            } else {
                w = (H * r) >> 0;
                h = H;
            }
        }
        return {
            'width': w,
                'height': h
        };
    };
}