<style>
* {
padding: 0;
margin: 0;
}
.box {
width: 50px;
height: 50px;
background: skyblue;
position: fixed;
left: 0;
top: 0;
border-radius: 50%;
background: -webkit-radial-gradient(#f00, #00f) !important;
}
</style>
<body>
<div class="box"></div>
</body>
<script>
//第一种方法
var oBox = document.querySelector('.box');
maxLeft = document.documentElement.clientWidth - oBox.offsetWidth;
maxTop = document.documentElement.clientHeight - oBox.offsetHeight;
function fn(