0

我在我的页面上加载了一个谷歌方向小部件,其中包含以下代码:

<div class="directions">
  <script src="http://www.gmodules.com/ig/ifr?url=http://hosting.gmodules.com/ig/gadgets/file/114281111391296844949/driving-directions.xml&amp;up_fromLocation=&amp;up_myLocations=<%= @meeting.location.address %>&amp;up_defaultDirectionsType=&amp;up_autoExpand=&amp;synd=open&amp;w=320&amp;h=55&amp;title=Directions+by+Google+Maps&amp;lang=en&amp;country=US&amp;border=%23ffffff%7C3px%2C1px+solid+%23999999&amp;output=js"></script>
</div>

以上工作并且看起来很棒。我不想让上面的内容出现在页面上,而是希望在用户单击名为方向的链接时将其加载到颜色框中。问题是:我怎样才能让上面的内容在颜色框中打开?执行以下操作不起作用:

$.colorbox({href:"<the http link from above>"});

有任何想法吗?

4

1 回答 1

0

尝试这个:

$('.directions').click(function(){
    var src = $(this).find('script').attr('src');
    $.colorbox({ href: src });   
})
于 2012-08-16T22:43:26.453 回答