2013-07-27 1 views
1

URL을 열기를 원하는 버튼이 포함 된 간단한 팝업이 있습니다. 코딩 된대로 버튼이 활성화되어 있지 않아이 작업을 수행하는 데 올바른 코드를 찾을 수 없습니다.jquery popup : URL을 열기위한 버튼 얻기

기본 JQuery와 스크립트 :

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.js"></script> 

    <script type="text/javascript"> 

     $(document).ready(function() { 

      var id = '#dialog'; 

      $('#mask').fadeIn(1000);  
      $('#mask').fadeTo("slow",0.4); 

      var winH = $(window).height(); 
      var winW = $(window).width(); 

      $(id).css('top', winH/2-$(id).height()/2); 
      $(id).css('left', winW/2-$(id).width()/2); 

      $(id).fadeIn(5000);  

      $('.window .close').click(function (e) { 
      e.preventDefault(); 

     });  
    }); 

키 버튼의 코드는 다음과 같습니다

 $('#element_to_pop_up').bPopup({ 
     content:'iframe', 
     contentContainer:'#content', 
     loadUrl:'' 
      }); 

이를 :

 <div id="content"> 
     <a class="button green" href="http://www.google.com">Goto Url</a> 
    </div> 

내가 스크립트 추가 버튼을 활성화하려면 스크립트는 어떤 제안이 jQuery를 함수를 호출하는

답변

1

당신 아마 GOT에 대한 기쁘게 버튼

을 활성화 ('element_to_pop_up')$('element_to_pop_up')해야 그것은 #와 ID 접두사가, 그리고 경우는 . (점)와 클래스 접두사를

인 경우
$('#element_to_pop_up').bPopup({ 
     content:'iframe', 
     contentContainer:'.content', 
     loadUrl:'' 
     }); 
+0

고마워요, 고마워요. 고쳐 준 덕분에 완벽하게 작동합니다. –

+0

너무시기 상조 였고, 수정 작업으로 인해 팝업이 작동했지만 버튼이 활성화되지 않았습니다. 접두사 # 또는. 가기?