gpt4 book ai didi

php - 如何在 CI Web 应用程序的就绪状态下添加粘性 toast 通知

转载 作者:行者123 更新时间:2023-11-28 07:21:00 25 4
gpt4 key购买 nike

我们如何在 codeigniter 站点中添加粘性 toast 通知。我需要在主页加载粘性 toast 通知。我们该怎么做

我试过了。但它不起作用。

<div>

<p>
<span class="description">Show a success toast</span> <a href="javascript:showSuccessToast();">not
sticky</a>|<a href="javascript:showStickySuccessToast();">sticky</a>
</p>

<p>
<span class="description">Show a notice toast</span> <a href="javascript:showNoticeToast();">not sticky</a>|<a
href="javascript:showStickyNoticeToast();">sticky</a>
</p>

<p>
<span class="description">Show a warning toast</span> <a href="javascript:showWarningToast();">not
sticky</a>|<a href="javascript:showStickyWarningToast();">sticky</a>
</p>

<p>
<span class="description">Show a error toast</span> <a href="javascript:showErrorToast();">not sticky</a>|<a
href="javascript:showStickyErrorToast();">sticky</a>
</p>

</div>

<script type="text/javascript">

function showSuccessToast() {
$().toastmessage('showSuccessToast', "Success Dialog which is fading away ...");
}
function showStickySuccessToast() {
$().toastmessage('showToast', {
text: 'Success Dialog which is sticky',
sticky: true,
position: 'top-right',
type: 'success',
closeText: '',
close: function () {
console.log("toast is closed ...");
}
});

}

最佳答案

即使我对 toast 消息有一些问题,所以我也这样做了

HTML 代码

<div class="toast toast-default">
<button class="toast-dismiss"><i class="fa fa-times"></i></button>
Oops!!! Something went wrong while adding this product. Please try again after sometime.
</div>

CSS

.toast-default {
background: rgba(53, 164, 178, 0.8) none repeat scroll 0 0;
color: #fff;
}
.toast {
border-radius: 5px;
display: none;
font-family: "ralewayregular";
padding: 20px 10px 10px;
position: fixed;
right: 20px;
text-align: center;
top: 100px;
width: 250px;
z-index: 1000;
}

脚本代码

 $('.toast-default').fadeIn(400).delay(3000).fadeOut(400);

当你想要 toast 消息时调用该脚本。

关于php - 如何在 CI Web 应用程序的就绪状态下添加粘性 toast 通知,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32087728/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com