2011-12-20 4 views
0

작은 웹 페이지를 코딩 중이며 페이지로드 시작시 simplemodal을 시작하고 싶습니다.페이지로드시 simplemodal 시작

그래서 지금은 내가 박스가 poppes 텍스트가 그것을 클릭 할 때 당신이하는 입력으로 버튼을 볼 수 있습니다

<div id='container'> 
    <div id='content'> 
     <div id='basic-modal'> 
      <input type='button' name='basic' value='Open' class='basic'/> 
     </div> 

     <!-- modal content --> 
     <div id="basic-modal-content"> 
      <h3>Random Text in the SompleModal box.</h3> 

     </div> 
    </div> 
</div> 

몸이 코드가 있습니다.

여기에도 basic.js가 있지만 이해가 안됩니다. 왜냐하면 며칠 전 웹 디자인을 배우기 시작했기 때문입니다.

basic.js

도 포함
jQuery(function ($) { 
    // Load dialog on page load 
    //$('#basic-modal-content').modal(); 

    // Load dialog on click 
    $('#basic-modal .basic').click(function (e) { 
     $('#basic-modal-content').modal(); 

     return false; 
    }); 
}); 

는 이러한 파일입니다.

<script type='text/javascript' src='js/jquery.js'></script> 
<script type='text/javascript' src='js/jquery.simplemodal.js'></script> 

나는 onLoad 또는 jscript .ready를 사용할 수는 있지만 그 방법은 모른다. 이와 시도

$(document).ready(function() { 
    // Any thing in here will execute when the DOM has finished loading 
    $('#basic-modal-content').modal(); 
}); 

jQuery Docs for .ready()

답변

2

:

+0

모두를 시도, 당신의 잘 일을! 고맙습니다! – Noli

+0

당신은 환영합니다 :) –

3

$(document).ready() 기능을 사용하여 내 대답을 편집

<script> 
function openModal() 
{ 
    $('#basic-modal-content').modal(); 
} 
</script> 

<body onload="openModal();"></body> 
+0

, 당신은 더 나은) –