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

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

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

layer官方API默認(rèn)右邊按鈕=右上角X按鈕,點(diǎn)擊=關(guān)閉彈窗

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

之前試過(guò)的寫(xiě)法(錯(cuò)誤):

layer.confirm('想去哪個(gè)網(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ù)相當(dāng)于右邊按鈕和X綁定在一起,不能分離

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

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

代碼如下:

layer.confirm('想去哪個(gè)網(wǎng)站?',{icon:3,btn:['新浪','百度']},function(index){         //這里的icon:3 是‘?'圖標(biāo),在上次博客試出來(lái)的共存方法
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()右邊按鈕實(shí)現(xiàn)href的例子就是小編分享給大家的全部?jī)?nèi)容了,希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。

相關(guān)文章

最新評(píng)論