2011-02-28 5 views
1

JQuery Bubble Popup 라이브러리를 사용하여 innerHtml 변수에 숨겨진 div를 표시하려고합니다. 내가 이것을 넣으면JQuery Bubble Popup : innerhtml hidden div

가 작동 내가 예상대로 작동하지 않는 것은이
<div class="button"> Show stuff </div> 
<div class="information"> foo </div> 

<div class="button"> Show stuff </div> 
<div class="information"> bar </div> 

<script> 
$(document).ready(function(){ 
     $('.information').hide(); 
     $('.button').CreateBubblePopup({ 
             position: 'bottom', 
             align: 'center', 
             width: '300', 
             innerHtml: $(this).next(".information").html(), 
             innerHtmlStyle: { color:'#000', 'text-align':'left', 'font-size':'110%' }, 
             themeName: 'grey', 
             themePath: '/static/images/jquerybubblepopup-theme', 
             selectable: true, 
             }); 
     }); 


</script> 

이 문제가 라인

innerHtml: $(this).next(".information").html(), 

에 있기 때문에 : 지금은 이것을 가지고

innerHtml: 'testing jquery bubblepopup', 
+0

정확히 무엇을 설명 할 수 있습니까? –

답변

1

이 라인의 문제 :

innerHtml: $(this).next(".information").html(), 

this이 그것이 무엇을 의미한다고 생각하는지 언급하지 않았다는 것입니다. I 당신이 영향을받는 현재 버튼을 참조하고 싶지만, "준비"핸들러 컨텍스트에 적용되는 값은 this입니다. 당신은 (몇 가지 중) 무엇을 할 수

의 사용이다 ".each()을"기능 : 또한

$('.button').each(function() { 
    $(this).CreateBubblePopup({ 
    position: 'bottom', 
    align: 'center', 
    width: '300', 
    innerHtml: $(this).next(".information").html(), 
    innerHtmlStyle: { color:'#000', 'text-align':'left', 'font-size':'110%' }, 
    themeName: 'grey', 
    themePath: '/static/images/jquerybubblepopup-theme', 
    selectable: true 
    }); 
}); 

당신은 거품 팝업 파라미터 객체의 끝에서 길 잃은 쉼표를 가지고있는 IE에서 오류가 발생합니다.