R. Rajesh Jeba Anbiah wrote:
> I see the @title I have proposed is implemented in different
> manner. IIRC, previously itself similar @title, @name was working.
> But, I was talking about unobtrusive modal dialog whose Title (title
> of the modal dialog) should be controlled with the title attribute.
> So, I was actually proposing:
> ajax: '@href',
> title: '@title' // title of the dialog could be injected via <a
> title="foo">...
>
Since jqModal does not have any predefined dialogs or windows or
notices, this is best handled in your onOpen callback. How will jqModal
know where to print the title? Here is an example;
<div id="dialog">
<div class="title">I am a title</div>
I am the content
</div>
...
$('#dialog').jqm(
{},
function(h) {
var title = h.t.title || 'default title'; // the triggers "title"
attribute (if exists)
$('div.title',h.w[0]).html(title); // assign the title to dialog
h.w.show();
}
);
> Some more proposes:
> 1. Provision for prefetch. And again the attribute could be injected
> with say <a href="foo.php" class="remote prefetch".. and...
> prefetch: true/false,
>
> 2. Caching too? Like:
> <a href="foo.php" class="remote prefetch cache".. and...
> cache: true/false,
>
See image caching @ the example page (near the top). A similar method
can be used.
> 3. Helper function $.jqm()-- so that alert() could be redirected to
> $.jqm() easily
>
This is accomplished easily enough -- I do not think bloating the plugin
to override the alert function is a good idea. jqModal is on a diet ;)
Here is a concise method;
---
<a href="#" id="alertTrigger">Show Last Alert</a>
<div id="alert" style="color: red; background-color: white;
padding:10px;"></div>
<script type="text/javascript">
function alert(i) { $('#alert').html(i); $('#alertTrigger').click();}
$().ready(function(){
$('#alert').jqm({trigger: '#alertTrigger'});
alert('This is a test');});
</script>
----
There is a limiting factor: alerts will be only be overriden if executed
after the $().ready() call which sets up the dialog on #alert.
The next update will provide functionality for adding triggers and
executing the open/close function of any element $.jqm() has been called
on. I think this addresses your question #4 -->
> 4. (2) will also solve the need for the reverse syntax--currently we
> need to give the trigger selector as a property; often I need to do
> something like:
> $("a.remote, a.foo, a.foo2, input#sumbit").click(function() {
> //show modal dialog with the $(this) attribute or so...
> });
Making an even more concise alert() override possible;
---
<div id="alert" style="color: red; background-color: white;
padding:10px;"></div>
<script type="text/javascript">
function alert(i) { $('#alert').html(i).jqmShow(); }
$().ready(function(){
$('#alert').jqm();
alert('This is a test');});
</script>
----
I plan to add the following functions in revision 7;
$.jqmShow() -- open/show the dialog
$.jqmHide() -- hide/close the dialog
---
$.jqmAddTrigger(e) -- assign a trigger (jqmShow()) event to the passed
element(s)
$.jqmAddClose(e) -- assign a close (jqmHide()) event to the passed
element(s)
Of course jqmAddTrigger() and jqmAddClose() are just shortcuts for;
$('selector').click(function() { dialog.jqmShow(); });
Anyway, let me know what you think.. and if I am missing anything.
~ Brice
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/