2011-03-17 2 views
0

JQuery colorbox를 다음과 같이 사용하고 있습니다. 버튼이있는 링크가 있습니다.이 클래스에는 cboxElement 클래스가 있습니다. colorbox의 html은 다른 JSP 파일의 링크에 있습니다. 사용자가 해당 링크를 클릭하면 colorbox가 나타나고 모든 것이 정상입니다.JSP 파일의 div 내에 someting을위한 다른 JSP 파일을 작성하지 않고 JQuery colorbox를 사용할 수 있습니까?

그러나 내 페이지 내에서 무언가를 위해 colorbox를 사용하려면 어떻게해야합니까? div 태그 사이에 다른 JSP 파일을 쓰지 않고도 사용자가 볼 수 없게되고 버튼을 클릭하면 나타납니다.

편집 : 발견 : 인라인 'true'인 경우 jQuery 선택기를 사용하여 현재 페이지의 내용을 표시 할 수 있습니다. 예 :

$("#inline").colorbox({inline:true, href:"#myForm"}); 

나는 이것이 내가 찾고있는 것이라고 생각하지만 어떤 예도 찾을 수 없다.

+0

나는 당신의 질문을 이해하지 못합니다. 인라인 HTML 예제는 [예제 페이지] (http://colorpowered.com/colorbox/core/example1/index.html)에서 찾고있는 것입니까? 그것은 숨겨진 인라인 HTML을 ColorBox –

+0

에 대한 입력으로 사용합니다. 위의 설명을 답으로 추가하십시오. –

답변

0

this page에서 내부 HTML의 예를 살펴보십시오. 나는 그것이 당신이 찾고있는 것이라고 믿습니다.

당신이 페이지의 소스를 보면,이 HTML 확인할 수있는 것들 :이 클릭에 ColorBox을 시작하는 링크가

<!-- This contains the hidden content for inline calls --> 
    <div style='display:none'> 

     <div id='inline_example1' style='padding:10px; background:#fff;'> 
     <p><strong>This content comes from a hidden element on this page.</strong></p> 
     <p>The inline option preserves bound JavaScript events and changes, and it puts the content back where it came from when it is closed.<br /> 
     <a id="click" href="#" style='padding:5px; background:#ccc;'>Click me, it will be preserved!</a></p> 

     <p><strong>If you try to open a new ColorBox while it is already open, it will update itself with the new content.</strong></p> 
     <p>Updating Content Example:<br /> 

     <a class="example5" href="../content/flash.html">Click here to load new content</a></p> 
     </div> 
    </div> 

:

<p><a class='example8' href="#">Inline HTML</a></p> 

이는 바인딩입니다 ColorBox :

$(".example8").colorbox({width:"50%", inline:true, href:"#inline_example1"}); 
+0

해당 웹 페이지에는 다양한 상황에 대한 데모 만 있습니다. 각 예제의 코드는 어떻게 볼 수 있습니까? – kamaci

+0

@kamaci 페이지 소스를 확인하십시오. Firefox를 사용하는 경우 페이지를 마우스 오른쪽 버튼으로 클릭하고 '페이지 소스보기'를 선택하십시오. –

관련 문제