Overthrow
A jQuery plugin to open a very simple modal using content from within the page or loaded via ajax.
Examples
1. Open some content specified in HTML
2. Open some content pulled in via ajax
Usage
For any link that you want to open in an overthrow layer, set the href
attribute to be the content you wish to load and then call .overthrow()
for it.
This plugin is only simple, and is set up to accept hrefs that are either a class/id which reference HTML elements within the current page (e.g. '#content
' or '.content
', for which the overthrow will load the contents of this element)
or else an external fragment of HTML specified by a URL (e.g. http://mysite.com/content.html
).
<a href="#content">Open my inline content</a>
<a href="http://mysite.com/content.html">Open my external content</a>
And the javascript to call the plugin:
$('a').overthrow();
You can optionally pass in some settings via options when calling overthrow()
, or for the customClass
option you can optionally use a data attribute on the link.
$('a').overthrow({
customClass: 'myclass',
afterLoad: function(){
alert('hello!');
}
});
Note: The show & hide transitions use CSS and corresponding javascript delays to match, so edit at your own peril. If you change or remove the CSS transitions, be sure to poke around and update the javascript also.
Options
customClass | A class that will be added to the overthrow wrapper. This can be specified in the settings object, or else as a data attribute on the link with the name data-overthrow-class |
---|---|
afterLoad | A callback that gets called once the content is added to the overthrow. |
To-do
- Add loading indicator while ajax content is retrieved