很酷的弹出登录效果

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  5. <title>登陆界面</title>
  6. <style type="text/css">
  7. * {
  8. margin:0;
  9. padding:0;
  10. font-size:12px;
  11. font-weight:normal;
  12. font-family:verdana, tahoma, helvetica, arial, sans-serif, "宋体";
  13. font-style:normal;
  14. list-style-type:none;
  15. text-decoration:none;
  16. }
  17. div#body input#fnbtn {
  18. width:78px;
  19. height:39px;
  20. border:none;
  21. cursor:pointer;
  22. position:absolute;
  23. top:40px;
  24. left:100px;
  25. background:transparent url('http://www.youdian.com/images/index/default/logbg_v2.png') 0 -70px no-repeat;
  26. }
  27. div#mask {
  28. position:absolute;
  29. top:0;
  30. left:0;
  31. background:#fff;
  32. filter:alpha(opacity=20);
  33. -moz-opacity:0.2;
  34. z-index:100;
  35. }
  36. div#login {
  37. position:absolute;
  38. top:75px;
  39. left:100px;
  40. width:293px;
  41. z-index:200;
  42. }
  43. div#login h2 {
  44. height:26px;
  45. padding-top:3px;
  46. padding-left:25px;
  47. background:transparent url('http://www.youdian.com/images/index/default/logbg_v2.png') -84px -70px no-repeat;
  48. }
  49. div#login h2 input {
  50. height:18px;
  51. width:18px;
  52. float:right;
  53. border:none;
  54. cursor:pointer;
  55. margin:2px 6px 0 0;
  56. background:transparent url('http://www.youdian.com/images/index/default/logbg_v2.png') 0 -169px no-repeat;
  57. }
  58. div#login h2 a {
  59. display:block;
  60. float:left;
  61. width:83px;
  62. height:26px;
  63. line-height:26px;
  64. text-align:center;
  65. text-decoration:none;
  66. color:#666;
  67. }
  68. div#login h2 a.cur {
  69. color:#f00;
  70. background:transparent url('http://www.youdian.com/images/index/default/logbg_v2.png') 0 -187px no-repeat;
  71. }
  72. div#login ul {
  73. padding:14px 0 18px 12px;
  74. background:transparent url('http://www.youdian.com/images/index/default/logbg_v2.png') -84px bottom no-repeat;
  75. }
  76. div#login ul li {
  77. padding-left:60px;
  78. margin-top:10px;
  79. display:inline-block;
  80. }
  81. div#login ul li {
  82. display:block;
  83. }
  84. div#login ul li:after {
  85. content:"youdian";
  86. clear:both;
  87. display:block;
  88. height:0;
  89. visibility:hidden;
  90. }
  91. div#login ul li tt {
  92. float:left;
  93. width:60px;
  94. margin-left:-70px;
  95. text-align:right;
  96. line-height:22px;
  97. color:#444;
  98. }
  99. div#login ul li div input.cell, div#login ul li div input.cell2 {
  100. height:16px;
  101. padding:2px;
  102. line-height:16px;
  103. width:179px;
  104. border:1px #dcdcdc solid;
  105. color:#666;
  106. }
  107. div#login ul li div input.cell2 {
  108. width:50px;
  109. div#login ul li div label {
  110. color:#666;
  111. cursor:pointer;
  112. }
  113. div#login ul li div img {
  114. margin-bottom:-7px;
  115. margin-left:8px;
  116. }
  117. * html div#login ul li div img {
  118. margin-bottom:-4px;
  119. }
  120. *+html div#login ul li div img {
  121. margin-bottom:-4px;
  122. }
  123. div#login ul li div input#fnlogin {
  124. width:59px;
  125. height:21px;
  126. cursor:pointer;
  127. border:none;
  128. margin-right:15px;
  129. background:transparent url('http://www.youdian.com/images/index/default/logbg_v2.png') 0 -148px no-repeat;
  130. }
  131. div#login ul li p {
  132. padding-top:4px;
  133. color:#f00;
  134. }
  135. </style>
  136. </head>
  137. <body>
  138. <div id="body">
  139. <input id="fnbtn" type="button" title="" />
  140. </div>
  141. <div id="mask" style="display:none;"></div>
  142. <div id="login" style="display:none;">
  143. <h2>
  144. <input id="fnquit" type="button" title="退出登录" />
  145. <a href="#" class="cur" name="Email">Email登录</a><a href="#" name="用户名">用户名登录</a>
  146. </h2>
  147. <ul>
  148. <form id="LoginForm" name="LoginForm" action="/Login.do" method="post" enctype="multipart/form-data" >
  149. <li>
  150. <input id="loginType" name="loginType" type="hidden"/>
  151. <tt><label id="logtype" for="email">Email:</label></tt>
  152. <div><input id="username" name="username" type="text" class="cell"/></div>
  153. </li>
  154. <li>
  155. <tt><label for="password">密 码:</label></tt>
  156. <div><input id="password" name="password" type="password" class="cell" /></div>
  157. </li>
  158. <li>
  159. <tt></tt>
  160. <div><input id="reme" name="rememberme" type="checkbox" /> <label for="reme">下次自动登录</label>
  161. </div>
  162. </li>
  163. <li>
  164. <tt></tt>
  165. <div><input id="fnlogin" type="button"/><a href="#">忘记密码</a></div>
  166. </li>
  167. </form>
  168. </ul>
  169. </div>
  170. <script type="text/javascript">
  171. function g(obj) {
  172. return document.getElementById(obj);
  173. }
  174. var login = {
  175. title:null,
  176. show:function(){
  177. var sWidth,sHeight;
  178. sWidth = screen.width;
  179. sWidth = document.body.offsetWidth;
  180. sHeight=document.body.offsetHeight;
  181. if (sHeight<screen.height){sHeight=screen.height;}
  182. g("mask").style.width = sWidth + "px";
  183. g("mask").style.height = sHeight + "px";
  184. g("mask").style.display = "block";
  185. g("login").style.display = "block";
  186. g("login").style.right = g("body").offsetLeft + "px";
  187. // window.status = g("body").offsetLeft;
  188. },
  189. hide:function(){
  190. g("mask").style.display = "none";
  191. g("login").style.display = "none";
  192. }
  193. }
  194. g("fnbtn").onclick = function(){
  195. login.show();
  196. this.blur();
  197. this.style.backgroundPosition = "0 -109px";
  198. };
  199. g("fnlogin").onclick = function() {
  200. // The following 5 lines of code is used to get the login type & pass to the form
  201. // One More line of code is insert to root_index.jsp to capture the hidden value
  202. if (document.getElementById("logtype").innerHTML == "Email:") {
  203. document.getElementById('loginType').value = 'email';
  204. else {
  205. document.getElementById('loginType').value = 'mobile'
  206. }
  207. document.LoginForm.submit();
  208. };
  209. g("fnquit").onclick = function(){login.hide();g("fnbtn").style.backgroundPosition = "0 -70px";};
  210. var aa = g("login").getElementsByTagName("a");
  211. var aTab = new Array();
  212. for(var i=0; i<aa.length; i++){
  213. if(aa.parentNode.nodeName == "H2"){
  214. aTab.push(aa);
  215. }
  216. }
  217. for(var j=0; j<aTab.length; j++){
  218. aTab[j].onclick = function(){
  219. this.blur();
  220. if (this.className != "cur"){
  221. for(var k=0; k<aTab.length; k++){aTab[k].className = ""};
  222. this.className = "cur"
  223. g("logtype").innerHTML = this.name + ":";
  224. }
  225. }
  226. }
  227. </script>
  228. <script language="javascript">
  229. login.hide();
  230. </script>
  231. </body>
  232. </html>
 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
您可以通过使用CSS和JavaScript来实现底部动态效果。具体的实现方法如下: 1. 首先,在HTML文件中添加一个底部的容器,例如: ```html <div class="bottom-popup"> <p>这是一个底部窗口</p> <button class="close-btn">关闭</button> </div> ``` 2. 使用CSS来设置底部容器的初始样式和动画效果,例如: ```css .bottom-popup { position: fixed; bottom: -300px; left: 0; width: 100%; height: 300px; background-color: #fff; padding: 20px; box-shadow: 0 -2px 10px rgba(0,0,0,0.2); transition: all 0.3s ease-in-out; } .bottom-popup.show { bottom: 0; } ``` 这里使用了`position: fixed`来固定底部容器的位置,`bottom`属性设置为负数,使其隐藏在屏幕外。在`.bottom-popup.show`中,将`bottom`属性设置为0,使其向上,同时使用`transition`属性设置动画效果。 3. 使用JavaScript来控制底部容器的显示和隐藏,例如: ```javascript const popup = document.querySelector('.bottom-popup'); const closeBtn = document.querySelector('.close-btn'); // 显示底部窗口 function showPopup() { popup.classList.add('show'); } // 隐藏底部窗口 function hidePopup() { popup.classList.remove('show'); } // 点击关闭按钮隐藏窗口 closeBtn.addEventListener('click', hidePopup); // 3秒后自动显示窗口 setTimeout(showPopup, 3000); ``` 这里使用了`querySelector`方法来获取底部容器和关闭按钮,定义了`showPopup`和`hidePopup`函数来控制容器的显示和隐藏。最后使用`setTimeout`方法来延迟3秒后自动显示窗口。 通过上述步骤,就可以实现一个简单的底部动态效果

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值