我写过这样的代码:
<style>
*{margin: 0 ; padding: 0;}
html,body{height:100%}
div#rect {background: #39c; width:100% ; height:100% ; clip: rect(200px 700px 400px 500px);position: fixed;}
</style>
<div id="rect"></div>
如何获取属性'clip'并使用 javascript 更改它?
就像$('#rect').css( 'clip', '...' )jQuery 一样。
它不能被element.style.clipRight = ''或改变element.style.clip = ''。