Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5978113
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T21:28:03+00:00 2026-05-22T21:28:03+00:00

I’m having some problems with a project I’m currently involved with. Here is my

  • 0

I’m having some problems with a project I’m currently involved with. Here is my situation. I am dynamically building and rendering a web page to an iframe, and I am wanting to offer the user the ability to resize the div elements within that rendered page in the iframe. To setup the context, consider the following snippets:

Host Page:

<html>
<head></head>
<body>
<div id="container">
    <iframe id="site" src="proxy.php" style="width:100%;height:100%;"></iframe>
</div>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.11/jquery-ui.min.js"></script>
<script src="http://jqueryui.com/ui/jquery.ui.resizable.js"></script>
<script>
    $("#site").load(function() {

        $("#site").contents().find("#test-resize").resizable({
            create: function(event, ui) {
                console.log("Create");
            },
            start: function(event, ui) {
                console.log("Start");
            },
            resize: function(event, ui) {
                console.log("Resize");
            }
        });
    });
</script>
</body>
</html>

Rendered Page:

<html>
<head>
<style>
    body { margin: 0; padding: 0; }
    #container { width: 960px;margin: auto;border: 1px solid #999; }
    header { display: block;background: #dedede;padding: 5px; }
    footer { display: block;padding: 10px;background: #555;color: #eee; }
    .ui-resizable { position: relative;}
    .ui-resizable-handle { position: absolute;font-size: 0.1px;z-index: 99999; display: block;}
    .ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; }
    .ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0; }
    .ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0; }
    .ui-resizable-e { cursor: e-resize; width: 7px; right: -5px; top: 0; height: 100%; }
    .ui-resizable-w { cursor: w-resize; width: 7px; left: -5px; top: 0; height: 100%; }
    .ui-resizable-se { cursor: se-resize; width: 12px; height: 12px; right: 1px; bottom: 1px; }
    .ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; }
    .ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; }
    .ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px;}
</style>
</head>
<body>
<div id="container">
    <div id="main">
        <header>
            <div><h1>Header</h1></div>
        </header>
    </div>
    <div id="body">
        <h2>Body</h2>
        <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
        <p>Mauris et sapien ligula, sit amet tincidunt ligula.</p>
    </div>
    <footer>
        <!-- I want the user to be able to resize this div -->
        <div id="test-resize">Footer Div</div>
    </footer>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.11/jquery-ui.min.js"></script>
<script src="http://jqueryui.com/ui/jquery.ui.resizable.js"></script>
</body>
</html>

So, what the host page is trying to do is reach into the rendered page and allow the ‘test-resize’ element to be resized. What I find puzzling is that the resizable plugin finds the ‘test-resize’ element and then adds the necessary resize handle divs and fires the ‘create’ event. However, when attempting to actually resize, nothing happens. Nothing changes, and no event fires.

With that, my question is, how can I (if at all) reach into an iframe and resize an element? Please note that these two pages are on the same domain.

Edit: I guess I should clarify another point. When adding the resize code to the generated page, the resize works fine, but I was wanting to keep the code at the host page level.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T21:28:03+00:00Added an answer on May 22, 2026 at 9:28 pm

    Okay, so after a little more digging, I was able to come up with a (hacked at best) solution. Unfortunately, it involves actually modifying jQuery UI. Note that I haven’t performed a thorough analysis of this result to determine what the performance (and potentially other metrics) implications are. But at any rate, there are a couple of spots that need to be changed in order to get this to work. Please note that all these changes are happening within events in the UI Mouse widget. The first change is in the _mouseDown event when the widget is binding the mousemove and mouseup events. Change:

    $(document)
        .bind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
        .bind('mouseup.'+this.widgetName, this._mouseUpDelegate);
    

    To:

    $($(this.element).get(0).ownerDocument)
        .bind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
        .bind('mouseup.'+this.widgetName, this._mouseUpDelegate);
    

    So, this basically binds these events to the owner document regardless if the owner document is a regular old HTML page or a page in an iframe. Second, we need to unbind these events when the user lets up off the mouse. In the UI Mouse widget’s _mouseUp event, change:

    $(document)
        .unbind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
        .unbind('mouseup.'+this.widgetName, this._mouseUpDelegate);
    

    To:

    $($(this.element).get(0).ownerDocument)
        .unbind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
        .unbind('mouseup.'+this.widgetName, this._mouseUpDelegate);
    

    Just unbinding the events that we bound above. Finally, we need to go back to the _mouseDown event and make a final change. At the top of this function, notice the line:

    // don't let more than one widget handle mouseStart
    if(mouseHandled) {return};
    

    We need to comment that out or delete it. Either one. After that, it appears that we can have resizability from within the and outside the iframe. Whether or not this breaks any other widgets or plugins, idk. But lets hope not. I would appreciate it if you all could offer some advice over potential effects of this and hopefully offer a more elegant solution. Thanks.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
We're building an app, our first using Rails 3, and we're having to build
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
Basically, what I'm trying to create is a page of div tags, each has
Seemingly simple, but I cannot find anything relevant on the web. What is the
I want use html5's new tag to play a wav file (currently only supported
I am currently running into a problem where an element is coming back from
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.