<!DOCTYPE html>
<html lang="en">
   <head>
      <meta charset="UTF-8">
      <script src="http://lib.sinaapp.com/js/jquery/1.9.1/jquery-1.9.1.min.js"></script>
      <style type="text/css">
        body{
          margin-bottom: 1500px;
        }
        #btn{
          position: fixed;
          right: 10px;
          bottom:10px;
        }
      </style>
      <script type="text/javascript">

          $(function(){
              $('#btn').click(function(){
                   //谷歌
                   $(document.body).animate({scrollTop: 0});
                   //火狐
                   $(document.documentElement).animate({scrollTop: 0});
              })
          })

      </script>
   </head>
   <body>
       <input type="button" id="btn" value="点我"/>
   </body>
</html>

js给当前url添加get参数,兼容旧参数

example updateQueryStringParameter("https://www.baidu.com?a=123",'b','hello') //result https://www.baidu.com/?a=123&b...

阅读全文

使用js弹出chrome windows通知提醒

废话少说,直接上代码 function notifyMe(notification_title, body) { if (Notification.permission !== "granted") Notification.re...

阅读全文

dropzone 插件只上传一张图片

<div> <div class="col-md-3"> <div class="form-group"> <label>你的头像</label> ...

阅读全文

欢迎留言