关于我们

质量为本、客户为根、勇于拼搏、务实创新

< 返回新闻公共列表

代码实现PC移动浮窗

发布时间:2019-10-24 15:58:47
<div id="dcwj" class="flabox" style="position:absolute;z-index:1000;">
<div class="flatit">
<span>
<a href="" title="招生简介" style="cursor: pointer;">招生简介</a>
</span>
</div>
 
    <ul class="flaul">
 
    <c:forEach items="${newsInfoList}" begin="0" end="2" var="cur">
 
    <c:url var="url" value="" />
 
      <li><a title="招生简介" style=" text-decoration:none;  href="" target="_blank">
 
        <c:out value="" />
 
      </a></li>
 
    </c:forEach>
 
    </ul>
</div>
 var x = 50,y = 60;
 
var xin = true, yin = true;
 
var step = 0.2;
 
var delay = 10;
 
var obj=document.getElementById("dcwj");
 
var width= window.screen.availWidth;
 
var height = window.screen.availHeight;
 
function dcwj() {
 
    var L=T=0;
 
    //var R= document.body.clientWidth-obj.offsetWidth;
 
    var R= width-obj.offsetWidth-35;
 
    //var B = document.body.clientHeight-obj.offsetHeight;
 
    var B = height-obj.offsetHeight-100;
 
    obj.style.left = x + (document.documentElement.scrollLeft || document.body.scrollLeft) + "px";
 
    obj.style.top = y + (document.documentElement.scrollTop || document.body.scrollTop) + "px";
 
    x = x + step*(xin?1:-1);
 
    if (x < L) { xin = true; x = L;}
 
    if (x > R){ xin = false; x = R;}
 
    y = y + step*(yin?1:-1);
 
    if (y < T) { yin = true; y = T; }
 
    if (y > B) { yin = false; y = B; }
 
 
}
 
var itl;
 
if(obj!=null){
 
    itl    = setInterval("dcwj()", delay);    
 
}
 
function closediv(){
 
   clearInterval(itl);
 
   obj.style.display = "none";
}



/template/Home/Zkeys/PC/Static