2011-02-27 24 views
1

jqmodalを使用してモーダル内に正しく表示されるように、ui multiselectというjqueryプラグインを取得できません。私は実際にはsimplemodalという別のモーダルと、別のマルチセレクションプラグインを運がないと試しました。私が集めることから、multiselectはmodal divの内部にあるので、uimultiselectのCSSは適用されていないようです。私は、この問題を抱えている他の人によって示唆された数々の異なることを試してきましたが、誰も働いていませおそらく私はそれを間違っていると思います。JQueryプラグインがモーダル内で動作しない

私のコードでは、モーダルの内側と外側にマルチセレクションを表示しました。それは完璧に外側で動作します。

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> 
<head> 
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> 
    <title>jQuery UI Multiselect</title> 
     <link rel="stylesheet" href="css/multiselect/common.css" type="text/css" /> 
    <link type="text/css" rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/base/ui.all.css" /> 
    <link type="text/css" href="css/multiselect/ui.multiselect.css" rel="stylesheet" /> 


    <link type="text/css" rel="stylesheet" href="css/jqModalForm.css" /> 
    <link type="text/css" rel="stylesheet" href="css/main.css" /> 
    <link type="text/css" rel="stylesheet" href="css/jqModal.css" /> 


    <script type="text/javascript" src="js/multiselect/jquery-1.4.2.min.js"></script> 
    <script type="text/javascript" src="js/multiselect/jquery-ui-1.8.custom.min.js"></script> 

    <script type="text/javascript" src="js/multiselect/plugins/localisation/jquery.localisation-min.js"></script> 
    <script type="text/javascript" src="js/multiselect/plugins/scrollTo/jquery.scrollTo-min.js"></script> 



    <script type="text/javascript" language="javascript" src="js/jqModal.js"></script> 
    <script type="text/javascript" language="javascript" src="js/jqDnR.js"></script> 
    <script type="text/javascript" language="javascript" src="js/jquery.dataTables.js"></script> 

    <script type="text/javascript" charset="utf-8"> 
     $().ready(function() { 
      $('#addShortCodes').jqm({ 
       trigger: '#addShortCodesTrigger', 
       overlay: 30, /* 0-100 (int) : 0 is off/transparent, 100 is opaque */ 
       overlayClass: 'whiteOverlay' 
      }) 
      .jqDrag('.jqDrag'); /* make dialog draggable, assign handle to title */ 

      // Close Button Highlighting. IE doesn't support :hover. Surprise? 
      $('input.jqmdX') 
      .hover(function(){ $(this).addClass('jqmdXFocus'); },function(){ $(this).removeClass('jqmdXFocus'); }) 
      .focus(function(){ this.hideFocus=true; $(this).addClass('jqmdXFocus'); }) 
      .blur(function(){ $(this).removeClass('jqmdXFocus'); }); 

     }); 
    </script> 



</head> 
<body> 
    <a href="http://github.com/michael/multiselect"><img style="position: absolute; top: 0; right: 0; border: 0;" src="http://s3.amazonaws.com/github/ribbons/forkme_right_white_ffffff.png" alt="Fork me on GitHub" /></a> 

    <div id="wrapper"> 

     <div id="content"> 


      <form action="index.html"> 
       <select id="countries" class="multiselect" multiple="multiple" name="countries[]"> 
        <option value="AFG">Afghanistan</option> 
        <option value="ALB">Albania</option> 
        <option value="FRA">France</option> 
       </select> 



       <br/> 
       <input type="submit" value="Submit Form"/> 
      </form> 

      <a href="#" id="addShortCodesTrigger">Add</a> 
    <script type="text/javascript" src="js/multiselect/ui.multiselect.js"></script> 

<script type="text/javascript"> 
    $(function(){ 
     $.localise('ui-multiselect', {/*language: 'en',*/ path: 'js/locale/'}); 
     $(".multiselect").multiselect(); 
     $('#switcher').themeswitcher(); 
    }); 
</script> 

      <div id="addShortCodes" class="jqmDialog"> 
       <div class="jqmdTL"> 
        <div class="jqmdTR"> 
         <div class="jqmdTC jqDrag">Add Short Codes</div> 
        </div> 
       </div> 
       <div class="jqmdBL"> 
        <div class="jqmdBR"> 
         <div class="jqmdBC"> 
          <form id="addMonitor" action="addMonitor.do" method="post"> 
           <div class="leftBox1"> 
            Short Codes: 
            <textarea name="shortCodes" cols="20" rows="8"></textarea> 

           </div> 
           <div class="rightBox1"> 
            <select id="countries" class="multiselect" multiple="multiple" name="countries[]"> 
             <option value="AFG">Afghanistan</option> 
             <option value="ALB">Albania</option> 
             <option value="FRA">France</option> 
            </select> 



           </div> 
           <input type="hidden" name="requestId" value="${monitorRequest.requestId}" /> 
           <div class="centerBox1"> 
            <input type="submit" value="Add" /> 
           </div> 
          </form> 

         </div> 
        </div> 
       </div> 
       <input type="image" src="dialog/close.gif" class="jqmdX jqmClose" /> 
      </div> 











      <script type="text/javascript" 
        src="http://jqueryui.com/themeroller/themeswitchertool/"> 
      </script> 
      <div id="switcher"></div> 

      <h2>Features</h2> 
      <ul> 
       <li>Search within available options, if there are a lots of them</li> 

       <li>Displaying counts of selected and available items</li> 
       <li>Select All/Deselect All Buttons</li> 
       <li>Dragging items from the available list to the selected list directly</li> 
      </ul> 

      <h2>Contributors</h2> 
      <ul> 
       <li><a href="http://github.com/michael/multiselect/">Michael Aufreiter</a></li> 

       <li><a href="http://github.com/yanickrochon/multiselect">Yanick Rochon</a></li> 
      </ul> 
      </p> 
      <h2>Misc</h2> 
      <p> 
       There are no limitations. Do whatever you want with this plugin. 
       If you did some nice modifications, just let me know (via Github). I'd be happy to include them. 
      </p> 

      <h2>Elsewhere</h2> 

      <ul> 
       <li><a href="http://quasipartikel.at/donut">DONUT? - Radial Navigator</a> <small style="color: red;">NEW!</small></li> 
      </ul> 
     </div> 

     <div id="footer"> 
      <p class="left">A <a href="http://quasipartikel.at/">Quasipartikel</a> Production</p> 

      <p class="right">Template adopted from <a href="http://orderedlist.com/demos/fancy-zoom-jquery/">orderedlist.com</a></p> 
      <br class="clear"/> 
     </div> 
    </div> 
    <script type="text/javascript"> 
     var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); 
     document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); 
    </script> 
    <script type="text/javascript"> 
     try { 
      var pageTracker = _gat._getTracker("UA-10368067-1"); 
      pageTracker._trackPageview(); 
     } catch(err) {}</script> 
</body> 
</html> 
+0

Firebugは何を言いますか? –

答えて

0

</body>前と対象選択の後、あなたのjqueryのコードを配置してみてください...対象選択後 のでjqueryのコードは、それを起動することができます

は、ここに私のhtmlです。 jqueryは後でターゲットを操作する必要があるためです。

+0

私はあなたが何を意味するか分かりません。どのターゲットセレクタの前後にどのコードを配置しますか? – Jeremey

+0

アップデートを読んで、あなたのターゲットセレクタが#addShortCodes idタグのようなjqueryに使用するのですか? –

+0

ok、私はマルチ選択jsをモーダルトリガーの下に移動しました。まだ動かない。上記の更新されたコードを見てください。他の提案はありますか? – Jeremey

0

All three of the following syntaxes are equivalent:

  • $(ドキュメント).ready(ハンドラ)
  • $()。(ハンドラ)レディ(これは推奨されません)
  • $(ハンドラ)

推奨されない構文を使用している可能性があります。

$(document).ready(function() { 

の代わりに、この

$().ready(function() { 
0

私は問題を解決しました。 jqmodalのコールバックにmutlectlect jsを適用する必要がありました

 <script type="text/javascript" charset="utf-8"> 
     $(document).ready(function() { 
      var myOpen=function(hash){ 
       hash.w.css('opacity',1).show(); 
       $(".multiselect").multiselect(); 
       $.localise('ui-multiselect', {/*language: 'en',*/ path: 'js/locale/'}); 
      }; 
      $('#addShortCodes').jqm({ 
       trigger: '#addShortCodesTrigger', 
       overlay: 30, /* 0-100 (int) : 0 is off/transparent, 100 is opaque */ 
       overlayClass: 'whiteOverlay', 
       onShow:myOpen 
      }) 


      .jqDrag('.jqDrag'); /* make dialog draggable, assign handle to title */ 

      // Close Button Highlighting. IE doesn't support :hover. Surprise? 
      $('input.jqmdX') 
      .hover(function(){ $(this).addClass('jqmdXFocus'); },function(){ $(this).removeClass('jqmdXFocus'); }) 
      .focus(function(){ this.hideFocus=true; $(this).addClass('jqmdXFocus'); }) 
      .blur(function(){ $(this).removeClass('jqmdXFocus'); }); 

     }); 
    </script> 
関連する問題