A super tiny sticky alerts plugin
This pen from Thommy Browne caught my eye. The sticky alert bar was made with some very simple jquery and a bit of CSS.
So, if nothing else, this was simply an exercise in creating a jQuery plugin.
Using the plugin is extremely easy. Just define the container you want the alert to sit in, make sure jQuery and
jquery.stickyalerts.css) is loaded, define some options, and you’re set!
You can also use jQuery Sticky Alerts with bower and npm.
barColor: '#222', // alert background color
barFontColor: '#FFF', // text font color
barFontSize: '1.1rem', // text font size
barText: 'I like bass and car audio :)', // the text to display, linked with barTextLink
barTextLink: 'https://www.longren.io/', // url for anchor
cookieRememberDays: '2', // in days
displayDelay: '3000' // in milliseconds, 3 second default
Get It For WordPress
I’m new to building jQuery plugins, so let me know if I’ve made any errors or if you see anything I could be doing better (I want to learn!!). You can leave a comment on this post or create an issue at GitHub. Pull requests are also welcome!
If you decide to use Sticky Alerts in a project, I’d love to know about it! Just drop a link in the comments.
Well, now what?
Work with Me
I'm available for hire and always taking new clients, big and small. Got a project or an idea you'd like to discuss? Startup plan but no developer to make it happen? Just get in touch, I'd love to see if I can help you out!