Skip to content

Popit-v1.0

Latest
Compare
Choose a tag to compare
@offthehandle offthehandle released this 24 May 05:39
· 8 commits to master since this release

Popit.
Because sometimes you need a JS window; however, you want your content to be seen—not blocked as a popup window.

Popit came about to consolidate all the discrete functionality that I had been implementing for video windows, encapsulating all the features in a reusable jQuery plugin with conditional logic. Honestly, it was scripted in a just a couple hours—as an answer to other plugins that require additional libraries beside jQuery. If jQuery is not your primary JS Library, Popit is probably not for you. If you do use jQuery and have not found a better solution, Popit is lean and flexible.

Considering the problem of popup blockers, Popit uses HTML attributes to manage popup blocking by grabbing mostly HTML attribute values to pass to a new window. There's some clever thinking! In addition to the HTML values, Popit focuses the window. Why this is useful: you have a named target (supported), have popped up a window for the 2nd time, and you need it to come to the front. Popit also refreshes the window in a couple different ways. I found this to be essential for cross-browser compatibility. The idea behind the refresh, as I have used it, is parsing a window.location.hash using JS to pass the index of a playlist item—for video. It's necessary.

Lastly, Popit defers to each window being dynamically sized via HTML5 attributes, so use data-width and/or data-height to override defaults with dynamic settings. If you prefer another name for your width or height, you can pass them to built-in properties. Furthermore, the power of the $.extend utility method allows you to merge any object property: value passed in when the plugin is initialized, so if you think of some useful attributes apply them to your Popit project too.

Don't be shy collaborating to improve my repos!