在Wordpress页面的JQuery UI对话框中打开外部URL [英] Opening External URL in JQuery UI Dialog on Wordpress page

查看:80
本文介绍了在Wordpress页面的JQuery UI对话框中打开外部URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个针对Wordpress网站的自定义模板页面(使用修改后的二十一主题).在页面中,有以编程方式创建的链接.将有几个这样的链接:

I have a custom template page I'm building for a wordpress site (using a modified Twenty Eleven theme). In the page there are links that are created programmaticly. There will be several links such as this:

<a href="http://www.site.com.com/info.php?id=123" class="uimodal">More Information</a>

我希望具有uimodal类的任何URL都出现在jQuery UI模态窗口(对话框)中,但是我在执行此操作时遇到了问题.

I would like any URL with the class of uimodal to come up in a jQuery UI modal window (dialog) but I'm having problems getting it to do so.

我已经成功加载了jQuery UI.我已经在线尝试了多个代码段,但没有通过Firebug得到任何错误,它只是不加载模式(仅替换当前页面).

I've successfully loaded jQuery UI. I have tried several code snippets online, not getting any errors via Firebug, it just doesn't load modal (just replaces the current page).

感谢您的帮助!

谢谢.

推荐答案

尝试如下操作: http://jsfiddle. net/hSRdr/

$(function() { // same as $(document.ready(function() {
    $('a.uimodal').on('click', function() {
        var href = $(this).attr('href');

        $('<div>').append('<iframe src="' + href + '"></iframe>').dialog();
        return false;
    });
});

这篇关于在Wordpress页面的JQuery UI对话框中打开外部URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆