[jQuery] simplemodal, want function to run upon $(document).ready
Hello all,
I wonder if anyone can shed some light on my problem.
I am updating a site that uses the simplemodal plug in
http://
www.ericmmartin.com/projects/simplemodal/
to create a lightbox-esque
effect when opening included php files.
Now then, the plug-in uses a function that is called when the item in
the DOM is clicked:
$
'#__SELECTED_ELEMENT__:eq
0
'
.click
function
e
{
e.preventDefault
;
$.get
"__FILE.PHP__", function
data
{
$
data
.modal
{
close: false,
overlayId: 'modalOverlay',
containerId: 'miniProteanContainer',
onOpen: site_terms.open,
onClose: site_terms.close
}
;
}
;
}
;
Essentially, I want this function to run as soon at the document is
loaded.
I have tried:
1. Seeing if I could change the event type to LOAD
thinking I would
be tricky and bypass the whole click
and I can only change the event
type to hover.
2. Setting this function in the $
document
.ready
function
{} at the
root, assuming the function would run after the document was loaded.
see the following example
$
document
.ready
function
e
{
e.preventDefault
;
$.get
"__FILE.PHP__", function
data
{
$
data
.modal
{
close: false,
overlayId: 'modalOverlay',
containerId: 'miniProteanContainer',
onOpen: site_terms.open,
onClose: site_terms.close
}
;
}
;
}
;
Has anyone else encountered this? Any recommendations on how I should
attack the problem?
Thanks,
Domanique