欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

layer.confirm()右邊按鈕實現(xiàn)href的例子

 更新時間:2019年09月27日 16:15:40   作者:IdealWhite  
今天小編就為大家分享一篇layer.confirm()右邊按鈕實現(xiàn)href的例子,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧

layer官方API默認右邊按鈕=右上角X按鈕,點擊=關閉彈窗

此方法最終效果是右上角X保留關閉彈窗功能,并且右邊按鈕能設置(location.href="") 等

之前試過的寫法(錯誤):

layer.confirm('想去哪個網(wǎng)站?',{btn:['新浪','百度']},function(index){

layer.close(index);

location. rel="external nofollow" rel="external nofollow" ; }

,function(index){

layer.close(index);

location. rel="external nofollow" rel="external nofollow" ; }

})

第二條函數(shù)相當于右邊按鈕和X綁定在一起,不能分離

經(jīng)過審查元素,發(fā)現(xiàn)了一個強硬的方法,試了一下居然成功了

原理是直接給右邊按鈕綁上click事件,可以覆蓋插件效果

代碼如下:

layer.confirm('想去哪個網(wǎng)站?',{icon:3,btn:['新浪','百度']},function(index){         //這里的icon:3 是‘?'圖標,在上次博客試出來的共存方法
layer.close(index);
  location. rel="external nofollow" rel="external nofollow" ;  
})
$('.layui-layer-btn1').click(function(){              // .layui-layer-btn1 = 右邊按鈕class名
location. rel="external nofollow" rel="external nofollow" ;  
})

以上這篇layer.confirm()右邊按鈕實現(xiàn)href的例子就是小編分享給大家的全部內(nèi)容了,希望能給大家一個參考,也希望大家多多支持腳本之家。

相關文章

最新評論