Saturday, 31 March 2018

css sticky header


title
title
content
content
content
content
content
content


<style>
.my-title{
    height:30vh;
    width:100%;
    background-color:darkorange;
}

.my-header{
    height:20vh;
    width:100%;
    background-color:aqua;
}

.my-content{
    height:200vh;
    width:100%;
    background-color:lawngreen;
}

.my-sticky{
    top:0;
    position:absolute;
}

.my-sticky+.my-content{
    padding-top:40vh;
}

.my-body{
    height:100vh;
    overflow-y:scroll; 
    text-align: center;
    font-size: 10vh;
}

.my-outer-body{
    position:relative;
}



</style>

<br />
<div class="my-outer-body" id="outer_body">
    <div class="my-body" id="my_body" onscroll="scroll_function()">
        <div class="my-title">
        title<br />
        title</div>
        <div class="my-header" id="sticky_header">
        header</div>
        <div class="my-content" id="my_content">
        content<br />
        content<br />
        content<br />
        content<br />
        content<br />
        content</div>
     </div>
</div>
<script type="text/javascript">
       
        var is_sticky = false;

        function scroll_function () {         

            var sticky_header = document.getElementById("sticky_header");
            var my_content = document.getElementById("my_content");

            var bodyRect = document.getElementById("outer_body").getBoundingClientRect();
            var headerRect = sticky_header.getBoundingClientRect();
            var contentRect = my_content.getBoundingClientRect();

            var header_Offset_body = headerRect.top - bodyRect.top;
            var content_Offset_header = contentRect.top - headerRect.bottom;


            if (!is_sticky && header_Offset_body <= 0) {
                sticky_header.classList.add("my-sticky")
                sticky_header.style.right = "3vh"; 
                sticky_header.setAttribute("style", "width:" + my_content.clientWidth + "px"); 
                is_sticky = true;
            }

            if (is_sticky && content_Offset_header > 0) {
                sticky_header.classList.remove("my-sticky");
                is_sticky = false;
            }

        }     

    </script>

reference:
https://www.w3schools.com/howto/howto_js_sticky_header.asp
https://stackoverflow.com/questions/442404/retrieve-the-position-x-y-of-an-html-element
https://stackoverflow.com/questions/35070308/how-to-set-width-of-div-to-another-divs-width

Friday, 30 March 2018

css parallax


back
middle
front


<style>
.layers {
    -webkit-perspective: 1px;
    -webkit-perspective-origin: 50% 50%;
    height: 50vh;
    overflow-y: auto;
    /*margin-top:-20%;*/
}

.layer {
    position: absolute;
    margin: auto;
    width: 100%;
    height: 100%;
    -webkit-transform-style: preserve-3d;
    font-size: 150px;
    text-align: center;
    padding:100% 0;
}

.layer-front { 
    /*background-color: rgba(0, 255, 0, 0.7);*/
    color: red;
}

.layer-middle {
    -webkit-transform: translateZ(-1px) scale(2);
    -moz-transform: translateZ(-1px) scale(2);
    /*background-color: rgba(196, 0, 0, 0.7);*/
    color:green;
}

.layer-back {
    -webkit-transform: translateZ(-2px) scale(3);
    -moz-transform: translateZ(-2px) scale(3);
    /*background-color: rgba(196, 0, 196, 0.7);*/
    color:blue;
}
</style>

<div class="layers">
        <div class="layer layer-front">front</div>
        <div class="layer layer-middle">middle</div>
        <div class="layer layer-back">back</div>
    </div>

----------------------------------------------------------------
The scale factor can be calculated with 1 + (translateZ * -1) / perspective

reference:
https://www.w3schools.com/howto/howto_css_parallax.asp
https://keithclark.co.uk/articles/pure-css-parallax-websites/

Hai Nan trip







view and download pictures:

kijiji sell - digital scale



digital scale, fully working. stainless platform 10cm x 10cm. max weight 3000g, precision 0.1g.
Weighing Units: g, gn, ct oz,,ozt. dwt. Calibration weight is not included.

digital scale, fully working, stainless steel platform 5cm x 5cm. max load 200g, precision 0.01g.
Weighing Units: g, gn, ct oz,,ozt. dwt. Calibration weight is not included.

Monday, 19 March 2018

加拿大20大城市的富人得赚这么多

移民到了加拿大,移风易俗之其一是不问别人的钱财和收入,当然别人也不会将他的财产底数说给你听。对于我们生活的这个地方,熟悉的亲朋和近邻过得如何,你可能知道一些,对身边之外再大些范围的只能是雾里看物,凭着感觉去判断了。那么究竟在加拿大你是穷人还是富人,今天小编就带你认识一下在加拿大对于富人的定义。

  富人这个词,有加拿大不同城市是有不同定义的。

  当今,在加拿大富人意味着什么呢?当然,没有一个“富人”的定义,但是自大萧条以来,我们一直听到很多关于“1%”这个名词,我们经济中最高收入者似乎正在积累越来越多的世界财富。

1203130116231117-600x400.jpg

  那么,在加拿大年薪多少才能晋升为1%的富豪阶级呢?根据统计局数据,在2015年,要想进入这个1%顶尖俱乐部,年收入只要达到22.54万加元即可。


  《赫芬顿邮报》要求加拿大统计局按照城市对2016年人口普查的收入进行分析,他们发现城市间存在一些非常显著的差异。例如:在卡尔加里你想成为收入上层1%的富人,你的收入几乎要是魁北克省舍布鲁克(Sherbrooke)或者安大略省南部的尼亚加拉地区的上层1%收入的人的三倍。
  以下是加拿大20个最大城市,要想进入上层1%所需的收入,以及要成为上层收入20%所需的收入,这也是对“高收入”的定义。

  舍布鲁克(Sherbrooke),魁省:172,069元

32_162404159.jpg

  个人收入前20%:51,413元

  家庭年收入中值:73,250元

  圣凯瑟琳斯-尼亚加拉(St Catharines-Niagara),安省:177,591元

niagara-falls-1752042_640-600x400.jpg

  个人收入达前20%:53,393元

  家庭年收入中值:74,140元

  魁北克城(Quebec City):189,121元

frontenac-2257154_640-600x337.jpg

  个人收入达前20%:59,169元

  家庭年收入中值:87,570元

  温莎(Windsor),安大略省:200,561元

32_1A251339.jpg

  个人收入达前20%:57,950元

  家庭年收入中值:78,700元

  伦敦,安大略省:203,743元

32_1A302456.jpg

  个人收入达前20%:58,203元

  家庭年收入中值:80,570元

  温尼伯(Winnipeg):203,935元

32_1A31Kb.jpg

  个人收入达前20%:58,631元

  家庭年收入中值:81,880元

  哈利法克斯(Halifax):204,622元

halifax-2370263_640-600x297.jpg

  个人收入达前20%:61,125元

  家庭年收入中值:85,940元

  奥沙华(Oshawa),安大略省:206,696元

32_1A350431.jpg

  个人收入达前20%:66,207元

  家庭年收入中值:92,080元

  基奇纳-剑桥-滑铁卢(Kitchener-Cambridge-Waterloo)地区,安省。:214,098元

32_1A40C22.jpg

  个人收入达前20%:61,419元

  家庭年收入中值:86,930元

  维多利亚(Victoria),卑诗省:214,373元

victoria-bc-1242840_640-600x399.jpg

  个人收入达前20%:62,940元

  家庭年收入中值:89,640元

  蒙特利尔(Montreal):224,060元

32_1A452260.jpg

  个人收入达前20%:56,348元

  家庭年收入中值:76,950元

  里贾纳(Regina),萨省:232,623元

32_1A5064U.jpg

  个人收入达前20%:71,864元

  家庭年收入中值:97,940元

  汉密尔顿(Hamilton),安省:236,176元

32_1A51J59.jpg

  个人收入达前20%:62,978元

  家庭年收入中值:87,590元

  萨斯卡通(Saskatoon):240,932元

32_1A531424.jpg

  个人收入达前20%:68,683元

  家庭年收入中值:94,580元

  渥太华(安省部分):244,534元

canada-1343649_640-600x399.jpg

  个人收入达前20%:74,488元

  家庭年收入中值:104,070元

  温哥华:246,266元

32_1A60Q44.jpg

  个人收入达前20%:60,147元

  家庭年收入中值:79,930元

  圣约翰(St John’s):256,918元

32_1A622629.jpg

  个人收入达前20%:66,542元

  家庭年收入中值:96,320元

  埃德蒙顿(Edmonton):297,928元

32_1A644302.jpg

  个人收入达前20%:75,773元

  家庭年收入中值:101,870元

  多伦多:301,883元

toronto-1298016_640-600x399.jpg

  个人收入达前20%:61,665元

  家庭年收入中值:78,280元

  卡尔加里:451,609元

waters-3178900_640-600x399.jpg

  卡尔加里班芙公园。

  个人收入达前20%:78,924元

  家庭年收入中值:104,410元。