admin管理员组文章数量:1401964
I am working on a Notify JS Notification option. I have tried but its not working. If I remove Style and class name its working fine.
<style>
.notifyjs-happyblue-base {
white-space: nowrap;
background-color: lightblue;
padding: 5px;
}
.notifyjs-happyblue-superblue {
color: white;
background-color: blue;
}
</style>
<script src=".0.0.min.js"></script>
<script src="notify.js"></script>
<script src="notify.min.js"></script>
<script>
$(function(){
$.notify("Your Break is Approved", {
style: 'happyblue',
className: 'superblue'
title: "E-Contact Application"
});
});
</script>
I am working on a Notify JS Notification option. I have tried but its not working. If I remove Style and class name its working fine.
<style>
.notifyjs-happyblue-base {
white-space: nowrap;
background-color: lightblue;
padding: 5px;
}
.notifyjs-happyblue-superblue {
color: white;
background-color: blue;
}
</style>
<script src="http://code.jquery./jquery-3.0.0.min.js"></script>
<script src="notify.js"></script>
<script src="notify.min.js"></script>
<script>
$(function(){
$.notify("Your Break is Approved", {
style: 'happyblue',
className: 'superblue'
title: "E-Contact Application"
});
});
</script>
Share
Improve this question
edited Oct 17, 2017 at 20:20
halfer
20.4k19 gold badges109 silver badges202 bronze badges
asked Oct 17, 2017 at 18:43
MahaMaha
252 silver badges6 bronze badges
4
-
3
You need a ma after the class name. i.e.
className: 'superblue',
– p.s.w.g Commented Oct 17, 2017 at 18:47 - @p.s.w.g I have included ma its not working – Maha Commented Oct 17, 2017 at 18:50
-
2
It's not working isn't very descriptive. Are you seeing an error or unexpected results? Other than the typo, the only possible issue I can see is that you're importing
notify.js
andnotify.min.js
-- typicallyx.min.js
is just a minified version ofx.js
so there's no need to include both. I remend putting a snippet or fiddle together to demonstrate the issue you're seeing. – p.s.w.g Commented Oct 17, 2017 at 18:54 - From the official close reasons: Questions seeking debugging help ("why isn't this code working?") must include ... a specific problem or error. – halfer Commented Oct 17, 2017 at 20:21
2 Answers
Reset to default 4Step one, just include the script once... you are including the unprssed version, and the minified version...
<script src="http://code.jquery./jquery-3.0.0.min.js"></script>
<!--<script src="notify.js"></script> DITCH THIS LINE -->
<script src="notify.min.js"></script>
Step two, make sure your syntax is correct...
$(function(){
$.notify("Your Break is Approved", {
style: 'happyblue',
className: 'superblue', // <-- just a ma, but really important
title: "E-Contact Application"
});
});
Putting it all together...
<script src="https://code.jquery./jquery-3.0.0.min.js"></script>
<script src="https://cdnjs.cloudflare./ajax/libs/notify/0.4.2/notify.min.js"></script>
<script>
$.notify.addStyle('happyblue', {
html: "<div>☺<span data-notify-text/>☺</div>",
classes: {
base: {
"white-space": "nowrap",
"background-color": "lightblue",
"padding": "5px"
},
superblue: {
"color": "white",
"background-color": "blue"
}
}
});
$.notify("Your Break is Approved", {
style: 'happyblue',
className: 'superblue', // <-- just a ma, but really important
title: "E-Contact Application"
});
</script>
use $.notify.addStyle(...
befor $.notify("Message",...
$.notify.addStyle('happyblue', {
html: "<span><span data-notify-text/></span>",
classes: {
base: {
"white-space": "nowrap",
"background-color": "lightblue",
"padding": "5px"
},
superblue: {
"color": "white",
"background-color": "blue"
}
}
});
$.notify("Message", {
style: 'happyblue',
className: 'superblue'
});
<script src="https://ajax.googleapis./ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://rawgit./notifyjs/notifyjs/master/dist/notify.js"></script>
本文标签: javascriptNotify JS not workingStack Overflow
版权声明:本文标题:javascript - Notify JS not working - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744287828a2598967.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论