Archive for August, 2011
jQuery popup plugin August 4th, 2011
I seem to be doing a lot of bits and pieces of jQuery at the moment, which is good because I quite enjoy it. I must confess I used to feel like it was cheating but fortunately i’ve managed to shed that particular misconception and now use it in almost all the online stuff I work on.
So here’s another little plugin I knocked up for work, a jQuery popup script. Most of these bits start as some random function purchase discount viagra written for a particular site which I then make into a reusable plugin and add to my script library for re-use.
You feed this one an element ID (i’d suggest a div) and it’ll remove it from the DOM (that way you can initially stick it anywhere on the page as an accessible alternative to the pop up), re-append it just before the closing </body> tag, create (if required) a background overlay and open it up at the click of a button.
Optional settings include fade in / out, background on / off, colour and opacity, close button, and close on background click.
UPDATE 2: Now version 1.2 – The popup will now re-centralise when you resize the window, also fixed a couple of little bugs.
UPDATE: Now version 1.1 – i’ve fixed a bug wherein if you fired the same pop-up using multiple links, multiple versions of the background overlay were being created with the same ID. I can only apologise for this schoolboy error.