MonoX support board

Start the conversation, ask questions and share tips and solutions with fellow developers.

Non-registered users can only browse through our support boards. Please register now if you want to post your questions. It takes a second and it is completely free. Alternatively, you can log in without registration using your credentials at major sites such as Google, Microsoft Live, OpenId, Facebook, LinkedIn or Yahoo.

iframe Name field editing? (Closed) (Mono Support )

Viewed 72858 time(s), 12 post(s) 3/26/2012 5:35:14 PMby erin0201
erin0201

erin0201

3/29/2012 12:29:35 PM
Sure.  The part that MonoX is breaking I think is only because I can't seem to make a header for the page to reference the javascript in.  I'm just making a guess that that is why IE8 isn't utilizing the jquery/javascript code properly.  What I had in a regular aspx page was a simple jquery script that would scroll an iframe window once it was opened so that it stayed with you as you scrolled down the page.  This setup was a little different in that I didn't have a page with two iframes.  I had the gridview on a page and it would load the iframe with more information next to it on the same page.  The scrolling jquery script worked fine across all browsers this way.  However for MonoX I have a main page and decided to load my original directory page with gridview into one iframe and the more information frame into a second iframe when the gridview link was clicked.

Then when I tried to do this by loading the parent page into an iframe, and the scrolling iframe into a separate iframe the scrolling feature works just fine in Firefox and Chrome, but not in IE8.  I know IE8 is seeing part of the code because the iframe is loading via an openiframe() function call, but it ignores the window scrolling part whereas Firefox and Chrome do it just fine.

Here is the MonoX page that is working fine in Firefox and Chrome, but not in IE8.  When you click the link in the gridview on the directory page that is inside the first iframe the moreframe iframe opens up and is supposed to scroll with you along the page.

<%@ Page
    Language="C#"
    MasterPageFile="/MonoX/MasterPages/Default.master"
    AutoEventWireup="true"    
    Inherits="MonoSoftware.MonoX.BasePage"
    Theme="Default"
    Title=""
    %>
<%@ MasterType TypeName="MonoSoftware.MonoX.BaseMasterPage" %>  
<%@ Register TagPrefix="MonoX" TagName="Editor" Src="/MonoX/ModuleGallery/MonoXHtmlEditor.ascx" %>
<%@ Register Assembly="MonoX" Namespace="MonoSoftware.MonoX" TagPrefix="portal" %>


<asp:Content ID="Content1" ContentPlaceHolderID="cp" runat="server">
 
    <script type="text/javascript" src="../Intranet/scripts/jquery-1.3.2.min.js"></script>
   
   <script type="text/javascript" src="../Intranet/scripts/iframes.js"></script>
    <script type="text/javascript">
 
 
        window.onload = function () { closeiframe() }
         
    </script>
    <div class="main">
        <table cellpadding="0" cellspacing="0">
            <tr>
                <td class="left-column">
                <iframe class="iframeContent" id="iframeContent" name="iframeCont" src="directory.aspx" width="750px" height="4480px"
                    frameborder="0" allowtransparency="true" scrolling="no">
                </iframe>
            <portal:PortalWebPartZone HeaderText="Left part zone" ID="leftWebPartZone" runat="server" Width="100%" ChromeTemplateFile="LeftColumn.htm" ShowChromeForNonAdmins="true">
                    <ZoneTemplate>
                      <MonoX:Editor runat="server" ID="editor1" />             
                    </ZoneTemplate>
                </portal:PortalWebPartZone>           
                </td>
                <td class="right-column">   
                 
            <script type="text/javascript" src="../Intranet/scripts/iframes.js"></script>
                    <iframe class="iframeDir" id="IframeDir" name="moreframe" src="blank.html" width="210px" height="580px"
                    frameborder="0" allowtransparency="true" scrolling="no" onload="openiframe()">
                </iframe>
                    <portal:PortalWebPartZone HeaderText="Right part zone" ID="rightPartZone" runat="server" Width="100%" ChromeTemplateFile="RightColumn.htm">
                        <ZoneTemplate>
                            <MonoX:Editor runat="server" ID="editor2" /> 
                        </ZoneTemplate>
                    </portal:PortalWebPartZone>
                </td>
            </tr>
        </table>
    </div>
</asp:Content>



Here is my simple iframes.js file code:

// Initialize.
 
 
function closeiframe()
 {          
   parent.document.getElementById("IframeDir").style.display = "none"
 }
 
 function openiframe()
 {
     document.getElementById("IframeDir").style.display = "block"
      
     $(window.parent.document).ready(function () {
            var $scrollingDiv = $("#IframeDir");
 
            $(window.parent.document).scroll(function () {
                $scrollingDiv
                .stop()
                .animate({ "marginTop": ($(window.parent.document).scrollTop() + -150) + "px" }, "slow");
                 
            });
        });
 
 }

It doesn't make any difference whether I have the jquery/javascript code called via the iframes.js file, or load it right after the jquery include. It works fine in Chrome and Firefox, but not in IE8. Again, I'm just guessing that maybe IE8 is having a problem with the includes not actually being in the page "header' and instead being in a content area? I've tried loading the page into IE8's developer tools and don't have any errors come up on the jquery/javascript code. It opens the iframe just fine when the link is clicked, but ignores the jquery scrolling action.

Thanks in advance for any help/suggestions!
This content has not been rated yet. 
453 Reputation 61 Total posts
erin0201

erin0201

3/29/2012 1:00:45 PM
Ok I found the problem!

I had tried a lot of different jquery code to get it to work when I first tried loading the one page inside an iframe of a monox page and couldn't get anything to work.  When I loaded the main page inside an iframe and then opened the new iframe in an iframe on the monox page beside it instead of within that page, I got it to work in Firefox and Chrome and not IE8, but I just went back and looked at my old code now that I started using the two iframes theory and that has been working and changed my code back and it now works in IE8, Firefox, and Chrome!

Hopefully this might help someone else in the future!
Here is the fixed and working jquery code:
function openiframe()
 {
     document.getElementById("IframeDir").style.display = "block"
      
     $().ready(function () {
            var $scrollingDiv = $("#IframeDir");
 
            $(window).scroll(function () {
                $scrollingDiv
                .stop()
                .animate({ "marginTop": ($(window).scrollTop() + -150) + "px" }, "slow");
                 
            });
        });
 
 }
Rated 4.00, 1 vote(s). 
453 Reputation 61 Total posts
1 2