Tag: iframe

父级的JQuery UI对话定位中心

我有一个function片段如下…… function LoadTheDialog($url) { $dialog = $(”); $dialog.html(”); $dialog.dialog({ width: 555, modal: true, resizable: false, draggable: false, open: function (type, data) { $($dialog).parent().appendTo(“body”); } }).dialog(‘widget’).position({ my: “center”, at: “center”, of: window, collision: “none” }); }; 无论我到目前为止尝试了什么,对话框总是显示在浏览器的左上角…… 我错过了一些明显的东西吗 我还想包装静态宽度和高度,并将其自动大小设置为加载的远程内容的大小,但这些选项似乎无法按预期工作…… 提前致谢。

追加到iframe头的链接

我想将元素追加到iframe(fancybox)的头部 有一个奇怪的问题:当我使用Firefox将Breakpoint元素添加到Head的代码行时,它可以正常工作,但是当我正常运行站点而没有firebug它不起作用; 我正在使用fancybox 1.3.4并且代码在onComplete事件中运行 var cssLink = document.createElement(“link”) cssLink.href = “/themes/furniture/css/test.css”; cssLink .rel = “stylesheet”; cssLink .type = “text/css”; var f123= document.getElementById(‘fancybox-frame’); var d123= f123.contentDocument || f123.contentWindow.document; d123.head.appendChild(cssLink); UPDATE 我也尝试这个代码 var $head = $(“#fancybox-frame”).contents().find(“head”); $head.append($(“”, { rel: “stylesheet”, href: “/themes/furniture/css/test.css”, type: “text/css” } )); 但它也不起作用 TNX

使用Jquery跟踪iframe内的点击次数

我正试图找出一种用jquery跟踪iframe内部点击的方法。 iframe位于同一个域,但我似乎无法使其工作,这是我的代码: var clicks = 0; $(‘#myframe’).load(function() { alert(‘loaded’); var that = $(this); that.contents().find(‘a’).bind(‘click’, function(e) { e.preventDefault(); clicks++; $(‘#clicks’).html(clicks); }); }); Clicks: 0 什么可能是错的? 我在SO看到了与此问题非常类似的其他问题,但没有一个问题解决了我的问题。 更新: 我已经使用@Wes代码在http://www.politicos.biz/stack/iframe_click.php更新了我的代码,它适用于jsfiddle,但不适用于我的网站。

jQuery magnific-popup:打开2个弹出式iframe,宽度/高度不同

) 我的代码: OPEN POP1 OPEN POP2 我的JS: $(‘.pop’).magnificPopup({ type:’iframe’, midClick: true} ); 我希望POP1打开500px 200px,POP2打开400px 400px。 为POP1和POP2设置不同宽度/高度的方法是什么? 我必须在HREF中使用CLASS吗? 或者它是JS中的代码,通过创建$(。pop1)和$(。pop2)? 我在“.mfp-iframe-holder .mfp-content”类中播放了宽度/高度,但设置更改了pop1和pop2。 任何帮助都会很棒。 😉

jQuery Lightbox Evolution:在iframe外部加载灯箱

我正在使用jQuery Lightbox Evolution插件,我在iframe中有照片链接。 我希望Lightbox在父窗口的iframe外面打开。 在FAQ中,我发现我可以在父级上添加一些代码: function frameload(iframe) { var doc = iframe.contentWindow || iframe.contentDocument; if (doc.document) { doc = doc.document; }; $(‘.lightbox’, doc.body).lightbox(); }; 但是不行,因为我的代码是使用php内联生成的,动态的。 所以我不会在head标签中“初始化”插件,只需在代码中调用它即可。 我的代码片段初始化了插件: echo ”; echo ‘ $(document).ready(function(){ $(“#open_’.$emp_alias.'”).click(function(ev) { $.lightbox([‘; while($images_array = mysql_fetch_assoc($query_emp_images)) { echo ‘”/destaques/’.$images_array[‘path’].'”,’; } echo ‘]); ev.preventDefault(); }); }); ‘; 有一种方法可以在父窗口中加载它吗? 谢谢

使用jQuery将类添加到iframe中的元素

$(‘#source’).delegate(‘*’, ‘hover’, function() { $(this).addClass(‘hover’); }); $(‘#source’).delegate(‘*’, ‘mouseout’, function() { $(this).removeClass(‘hover’); }); $(‘#source’).delegate(‘*’, ‘click’, function() { alert($(this).html()); return false; }); 当我鼠标hover或点击Iframe内的任何元素时,没有任何反应。 Iframe位于同一个域中,而且我的印象是,只要Iframe src位于同一个域上,它就应该有效。 关于如何使这项工作的任何想法?

微小的编辑没有获得后期价值

这是我正在使用的代码 var editor = new TINY.editor.edit(‘editor’, { id: ‘tinyeditor’, width: 750, height: 350, cssclass: ‘tinyeditor’, controlclass: ‘tinyeditor-control’, rowclass: ‘tinyeditor-header’, dividerclass: ‘tinyeditor-divider’, controls: [‘bold’, ‘italic’, ‘underline’, ‘strikethrough’, ‘|’, ‘subscript’, ‘superscript’, ‘|’, ‘orderedlist’, ‘unorderedlist’, ‘|’, ‘outdent’, ‘indent’, ‘|’, ‘leftalign’, ‘centeralign’, ‘rightalign’, ‘blockjustify’, ‘|’, ‘unformat’, ‘|’, ‘undo’, ‘redo’, ‘n’, ‘image’, ‘hr’, ‘link’, ‘unlink’, ‘|’, ‘print’], footer: true, fonts: […]

jQuery-ui可以在iframe中进行排序

我在主框架中有droppable放置的元素,并且sortable在iframe app中进行sortable 。 我需要的是连接它们 – 能够将项目拖动到iframe的sortable 有我做过的: http : //jsfiddle.net/w9L3eorx/1/ 我有iframe里面 Foo Bar $(‘.content’).sortable({ iframeFix: true, placeholder: ‘block-placeholder’, update: function (event, ui) { // turn the dragged item into a “block” ui.item.addClass(‘block’); } }); 主框架 One Two $(‘.items div’).draggable({ helper: function(e) { return $(”).addClass(‘block’).text( $(e.target).text() ); }, iframeFix: true, connectToSortable: $(‘.content’, $(“#frame”)[0].contentDocument) }); 我看到了工作示例http://ma.rkusa.st/zepto-dnd/example.html 。 […]

使用jQuery UI拖放帧

我想这样做: 从包含IFRAME的第一个文档中拖动DIV元素 将此DIV元素放入IFRAME内的第二个文档中。 有没有办法使用jQuery UI draggable&droppable来实现这一目标? 或者以跨浏览器的方式执行此操作,可能还有另一个JS库?

从外部在iFrame中创建可拖动对象

我的问题:我需要从iframe外部创建可拖动的小部件(例如,这里是一个jslider)。 Container和iframe内容都来自同一个来源。 问题是jQuery将mousemove事件附加到错误的文档对象上。 http://jsfiddle.net/techunter/4pnxh 尝试移动滑块,它只能在鼠标触发iframe外的事件时移动。 请帮忙,我被困在这里 编辑:JQuery侦听滑块手柄上的单击并在单击事件上它在mousemove上创建一个新的侦听器,但在窗口内,而不是框架。 我正在考虑更改jquery lib并添加一个上下文(默认情况下是window.document)但是它的时间很长。