 
						使用教程
本代码兼容Chrome, Firefox, Safari, Opera,而IE需要9.0或以上版本(IE9+)
STEP 1: 创建HTML布局
| 1 2 3 4 5 6 7 8 9 10 11 12 13 | <sectionclass="cd-section">    <!-- section content here -->    <divclass="cd-modal-action">        <ahref="#0"class="btn"data-type="modal-trigger">Fire Modal Window</a> <!? 这是窗体按钮 -->        <spanclass="cd-modal-bg"></span>    </div>    <divclass="cd-modal">        <divclass="cd-modal-content">        <!? 这是窗体内容区域 -->        </div>    </div>    <ahref="#0"class="cd-modal-close">Close</a> <!? 这是关闭按钮 --></section> | 
STEP 2: 添加CSS样式
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | .cd-modal-action {    position:relative;}.cd-modal-action .btn {    width:12.5em;    height:4em;    background-color:#123758;    border-radius:5em;    transition:color 0.2s 0.3s,width 0.3s 0s;}.cd-modal-action .btn.to-circle{    width:4em;    color:transparent;    transition:color 0.2s 0s,width 0.3s 0.2s;}.cd-modal-action .cd-modal-bg {    position:absolute;    top:0;    left:50%;    transform:translateX(-2em);    width:4em;    height:4em;    background-color:#123758;    border-radius:50%;    opacity:0;    visibility:hidden;    transition:visibility 0s 0.5s;}.cd-modal-action .cd-modal-bg.is-visible{    opacity:1;    visibility:visible;} | 
STEP 3: 添加jQuery
本代码使用了jQuery,你可以通过下面代码来修改窗口大小。
| 1 2 3 4 5 6 7 8 9 | varbtnRadius = $('.cd-modal-bg').width() / 2,left = $('.cd-modal-bg').offset().left + btnRadius,top = $('.cd-modal-bg').offset().top + btnRadius - $(window).scrollTop(),scale = scaleValue(top, left, btnRadius, $(window).height(), $(window).width());functionscaleValue(topValue, leftValue, radiusValue, windowW, windowH) {    varmaxDistHor = (leftValue > windowW / 2) ? leftValue: (windowW - leftValue),    maxDistVert = (topValue > windowH / 2) ? topValue: (windowH - topValue);    returnMath.ceil(Math.sqrt(Math.pow(maxDistHor, 2) + Math.pow(maxDistVert, 2)) / radiusValue);} | 
特别申明:
			本站所有资源都是由网友投稿发布,或转载各大下载站,请自行检测软件的完整性!
			本站所有资源仅供学习与参考,请勿用于商业用途,否则产生的一切后果将由您自己承担!
			如有侵权请联系我们删除下架,联系方式:lei1294551502@163.com