用过的前端插件合集

用过的前端插件合集

FontAwesome字体

详细用法参见上述站点的Examples。

SweetAlert系列

示例:

基本使用:

  1. swal("标题","内容","success);

使用SweetAlert在Ajax提交成功(done)或失败(error)时分别提示不用的内容。

这是更新之前版本的写法

复制代码
function deleteRecord(recordID) {
    swal({
        title: "确定要删除这个产品吗?",
        text: "删除后可就无法恢复了。",
        type: "warning",
        showCancelButton: true, closeOnConfirm: false, confirmButtonText: "是的,我要删除!", confirmButtonColor: "#ec6c62", cancelButtonText: "容我三思" }, function (isConfirm) { if (!isConfirm) return; $.ajax({ type: "post", url: "/delete/", data: {"id": recordID}, success: function (data) { var dataObj = $.parseJSON(data); if (dataObj.status === 0) { //后端删除成功 swal("删除成功", dataObj.info, "success"); $("#p-" + recordID).remove() //删除页面中那一行数据 } else { swal("出错啦。。。", dataObj.msg, "error"); //后端删除失败  } }, error: function () { // ajax请求失败 swal("啊哦。。。", "服务器走丢了。。。", "error"); } }) }); }
复制代码

更新之后用这么写

复制代码
swal({
  title: "这里写标题",
  text: "这里放内容",
  icon: "warning",  // 这里放图标的类型(success,warning,info,error)
 buttons: { cancel: { text: "容我三思", visible: true, value: false }, confirm: { text: "我就是要删除" } } }).then(function (isConfirm) { if (isConfirm){ swal("你死定了", {button: "确认"}); }
复制代码

Toastr通知

toastr["success"]("你已登录成功!")

jQueryLazyload懒加载

示例:

复制代码
<!DOCTYPE html>
<html lang="zh-CN"> <head> <meta charset="UTF-8"> <meta http-equiv="x-ua-compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>懒加载示例</title> </head> <body> <div> <div><img src="img/0.jpg" alt="" class="lazy" data-original="img/5.jpg" width="600px" height="400px"></div> ... <div><img src="img/0.jpg" alt="" class="lazy" data-original="img/6.jpg" width="600px" height="400px"></div> </div> <script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script> <script src="jquery.lazyload.min.js"></script> <script> $("img.lazy").lazyload({ effect: "fadeIn", event: "click" }) </script> </body> </html>
复制代码

模板

一个不错的管理后台模板

扫描二维码关注公众号,回复: 6696711 查看本文章

用过的前端插件合集

FontAwesome字体

详细用法参见上述站点的Examples。

SweetAlert系列

示例:

基本使用:

  1. swal("标题","内容","success);

使用SweetAlert在Ajax提交成功(done)或失败(error)时分别提示不用的内容。

这是更新之前版本的写法

复制代码
function deleteRecord(recordID) {
    swal({
        title: "确定要删除这个产品吗?",
        text: "删除后可就无法恢复了。",
        type: "warning",
        showCancelButton: true, closeOnConfirm: false, confirmButtonText: "是的,我要删除!", confirmButtonColor: "#ec6c62", cancelButtonText: "容我三思" }, function (isConfirm) { if (!isConfirm) return; $.ajax({ type: "post", url: "/delete/", data: {"id": recordID}, success: function (data) { var dataObj = $.parseJSON(data); if (dataObj.status === 0) { //后端删除成功 swal("删除成功", dataObj.info, "success"); $("#p-" + recordID).remove() //删除页面中那一行数据 } else { swal("出错啦。。。", dataObj.msg, "error"); //后端删除失败  } }, error: function () { // ajax请求失败 swal("啊哦。。。", "服务器走丢了。。。", "error"); } }) }); }
复制代码

更新之后用这么写

复制代码
swal({
  title: "这里写标题",
  text: "这里放内容",
  icon: "warning",  // 这里放图标的类型(success,warning,info,error)
 buttons: { cancel: { text: "容我三思", visible: true, value: false }, confirm: { text: "我就是要删除" } } }).then(function (isConfirm) { if (isConfirm){ swal("你死定了", {button: "确认"}); }
复制代码

Toastr通知

toastr["success"]("你已登录成功!")

jQueryLazyload懒加载

示例:

复制代码
<!DOCTYPE html>
<html lang="zh-CN"> <head> <meta charset="UTF-8"> <meta http-equiv="x-ua-compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>懒加载示例</title> </head> <body> <div> <div><img src="img/0.jpg" alt="" class="lazy" data-original="img/5.jpg" width="600px" height="400px"></div> ... <div><img src="img/0.jpg" alt="" class="lazy" data-original="img/6.jpg" width="600px" height="400px"></div> </div> <script src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script> <script src="jquery.lazyload.min.js"></script> <script> $("img.lazy").lazyload({ effect: "fadeIn", event: "click" }) </script> </body> </html>
复制代码

模板

一个不错的管理后台模板

猜你喜欢

转载自www.cnblogs.com/yunwangjun-python-520/p/11116224.html