Pesci wrote:
> $(document).ready(function() {
>
> $('#open1').click(function(){
>
> $('#dialog').jqm({modal:true}).jqmShow().jqmAddClose('#close1');
> });
>
> $('#open2').click(function(){
>
> $('#dialog2').jqm().jqmShow().jqmAddClose('#close2');
> });
> });
A few things are wrong. You're attaching jqModal functionality
($(e).jqm()) to the element each time you click -- while jqModal can
handle this, it is bad practice. Also, by default jqModal assigns
triggers & closes.. see the README for more info but;
When $.jqm() is called on an element, it looks for elements (in the
entire DOM) with class "jqmodal" and automatically assigns them as an
"open" trigger. You can override this by passing the trigger parameter
as a string selector or a DOM element, or a jQuery object of elements
(again, see README), or FALSE (attempting to assign a trigger will be
skipped).
Similarly, when $.jqm() is called on an element, it looks for elements
(in children of the element/window) with class "jqmClose" and
automatically assigns them as a "close" triggers. You can change the
class name via the closeClass parameter.
So, with that said; here is one way I would do it;
<div class="jqmWindow" id="dialog1">
<a href="#" class="jqmClose">Cerrar</a>
<hr>
<em>READ ME</em> -->
Some text.
<br /><br />
Some more text.
</div>
<div class="jqmWindow" id="dialog2">
<a href="#" class="jqmClose">Cerrar</a>
<hr>
<em>LEEAME</em> -->
Texto.
<br /><br />
Mas texto.
</div>
<a href="#" id="open1">Open 1</a>
<a href="#" id="open1">Open 2</a>
<a href="#" id="openAll">Open ALL</a>
<script type="text/javascript">
$().ready(function(){
$('#dialog1').jqm({modal: true, trigger: '#open1'}).jqmShow();
$('#dialog2').jqm({modal: true, trigger: '#open2'}).jqmShow();
// as example... assigning triggers to open all
$('div.jqmWindow') // selects all windows
.jqmAddTrigger('#openAll');
});
</script>
---
Nada bad, eh? :)
~ Brice
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/