今天发一个能够自适应的弹框,自封装效果如图:
<!--<!doctype html>--> <!--<html>--> <!--<head>--> <!-- <meta charset="UTF-8">--> <!-- <title>Document</title>--> <!--</head>--> <!--<body>--> <!--<input type="button" id="btn" value="提示"/>--> <!--<div id="div"></div>--> <!--<img src="" alt="" id="img"/>--> <!--</body>--> <!--</html>--> <!----> <!--<script src="jq.js"></script>--> <!--<script>--> <!-- alerts('ncjn');--> <!-- /*--> <!-- * 弹框设定--> <!-- * */--> <!-- function alerts(num) {--> <!-- str = '<span style="left: 10%;top: 45%;width: 80%;height: 10%; background-color:
#808080;z-index: 4;color: white;text-align: center;line-height: 60px;position:fixed;border-radius: 10px;">'+num+'</span>';--> <!-- $('body').append(str);--> <!-- setTimeout("cle()",2000);--> <!-- }--> <!-- function cle(){--> <!-- $('.alert').remove()--> <!-- }--> <!--</script>-->
如有需要请自行调整更改即可!