2012-10-16 5 views
0

RSS 피드의 링크를 대화 상자로 열려고합니다. 나는 here에서 얻은 다음 코드를 시도하고있다. 링크가 대화 상자를 열지 않습니다. 내가 뭘 잘못하고 있는지 제안 해. 감사jQuery UI 대화 상자에서 동적 링크로드

$(document).ready(function() { 
       $('a#URLLoad').live('click', function(e) { 
        e.preventDefault(); 
        var page = $(this).attr("href") 
        var pagetitle = $(this).attr("title") 
        var $dialog = $('<div></div>') 
        .html('<iframe style="border: 0px; " src="' + page + '" width="100%" height="100%"></iframe>') 
        .dialog({ 
         autoOpen: false, 
         modal: true, 
         height: 625, 
         width: 500, 
         title: pagetitle 
        }); 
        $dialog.dialog('open'); 
       }); 

      }); 

    <li class="ui-state-default"> 
<a class="URLLoad" href="http://feeds.arstechnica.com/~r/arstechnica/index/~3/4UlQiQB2n54/">New Xbox interface brings Windows 8 "Metro" style to the console</a></li> 

UPDATE :http://jsfiddle.net/daxnp/

+1

가 JQuery와 UI의 참조 및 CSS를 포함하지 않은 것으로 생각하는 모양이 업데이트 한 [나는 그것을 구조화하는 다른 방법을 제안 할 수 있습니까? (http://jsfiddle.net/3E6Vp/). 또한 autoOpen이 생성 직후에 바로 호출하는 것을 막을 이유는 불필요한 중복입니다. – Ohgodwhy

+1

잘 작동합니다. 여기에 피들 http://jsfiddle.net/zQdb4/1/ –

+0

나를 위해 didnt 일 – jsp

답변

1

당신은 클래스하지 ID가 당신이 $('a#URLLoad')

$('a.URLLoad')으로 업데이트를 변경해야이

$(document).ready(function() { 
       $('a.URLLoad').live('click', function(e) { 
        e.preventDefault(); 
        var page = $(this).attr("href") 
        var pagetitle = $(this).attr("title") 
        var $dialog = $('<div></div>') 
        .html('<iframe style="border: 0px; " src="' + page + '" width="100%" height="100%"></iframe>') 
        .dialog({ 
         autoOpen: false, 
         modal: true, 
         height: 625, 
         width: 500, 
         title: pagetitle 
        }); 
        $dialog.dialog('open'); 
       }); 

      }); 

같은 코드를 변경 사용하고 있습니다 :

난 당신의 바이올린은 여기

Demo 내가 문제가 당신이

+0

대화 상자에 URL을로드하지 마십시오. – jsp

+0

당신은 바이디를 만들 수 있습니까? – rahul

+0

은 지금 당신을 위해 일하고 있습니다. – rahul

관련 문제