通知/Notify

用法

创建可以被拨动显示的通知,并且能自动淡出。

当你将鼠标悬停在通知上面时,它不会自动消失,直到你移开鼠标。还可以通过点击关闭通知。

                        
                            $('#j-btn').notify('您有新的消息!');
                        
                    

图标

可以在通知信息内嵌HTML,比如图标

                        
                            $('#j-btn-2').notify({ message: '<i class="icon-info"></i> 我是有图标的!'});
                        
                    

定时/延迟

我们可以设置timeout通知信息隐藏的时间。若设置为0,则不隐藏!

                        
                            $('#j-btn-3').notify({ message: '<i class="icon-info"></i> 我是有图标的!', timeout: 1000});
                        
                    

定位

添加以下参数中的一个来调整通知出现的位置。

属性 描述 示例
'top-center' $.notify({message:'顶部居中', pos: 'top-center'})
'top-left' $.notify({message: '左上角', pos: 'top-left'})
'top-right' $.notify({message: '右上角', pos: 'top-right'})
'bottom-center' $.notify({message: '底部居中', pos: 'bottom-center'})
'bottom-left' $.notify({message: '左下角', pos: 'bottom-left'})
'bottom-right' $.notify({message: '右下角', pos: 'bottom-left'})
'vcenter' $.notify({message: '居中', pos: 'vcenter'})
                                
                                    <button class="btn default" data-toggle="tooltips" title="Hover me">Hover me</button>
                                
                            

状态

选项 可用的值 默认值 描述
offset int 9 与源元素之间的偏移量
pos string 'top' 工具提示组件定位
animation boolean true 工具提示的淡入动画
delay int 0 提示组件延迟显示多少毫秒
cls string '' 自定义类,用来添加显示/Custom class to add on show