为两个iframe创建常用卷轴 [英] Create common scrolls for two iframes

查看:78
本文介绍了为两个iframe创建常用卷轴的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





 <   div     id   =   divMain >  
< div id = divChildOne 样式 = float:left; width:50%; >
< asp:标签 runat = server ID = lableOne 字体粗体 = true > < / asp:Label >
< br / >
< iframe id = iFrameOne runat = 服务器 style = width:100%; / >
< ; / div >
< div id = divChildTwo 样式 = float:right;宽度:50%; >
< asp:标签 runat = server ID = labelTwo < span class =code-attribute> Font-Bold = true > < / asp:Label >
< br / >
< iframe < span class =code-attribute> id = iFrameTwo runat = server < span class =code-attribute> style = width:100%; / >
< / div >
< / div < span class =code-keyword>>





这是我要显示的页面设计并排文档。



现在我要创建的是两个滚动条,一个垂直和水平,当我滚动其中任何一个时,两个文档都会滚动同时。



我虽然给了divMainoverflow:auto属性和溢出:隐藏到其他控件的其余部分。但是,当我运行时,有iframe的滚动条。滚动条属于iframe中的div,其id为xxxx。



我不知道div来自哪里。可能是我正在展示的文件,它是一份infopath报告。





我该怎么办





编辑7月16日: -



我能够隐藏滚动条和虽然我已经将divMain溢出滚动,但它已被禁用。



编辑7月17日: -



我给了父div maxheight(由于分辨率问题我觉得很好),现在滚动来了高度。



现在我想让孩子控制( iframe)当我滚动主div滚动时滚动的内容



提前谢谢





Arjun Menon

解决方案

(1)为滚动事件火灾添加Jquery文件



(2)你在页面右边有两个ifmare在你的页面中添加这个javascript代码



 <   script     type   =  text / javascript    language   =  javascript >  


(document).ready(function(){


(window.frames [0])。on('scroll',function(){

Hi,

<div id="divMain">
    <div id="divChildOne" style="float: left; width: 50%;">
       <asp:Label runat="server" ID="lableOne"  Font-Bold="true"></asp:Label>
       <br />
       <iframe id="iFrameOne"  runat="server" style="width:100%;" />
    </div>
    <div id="divChildTwo" style="float: right; width: 50%;">
        <asp:Label runat="server" ID="labelTwo"  Font-Bold="true"></asp:Label>
        <br />
        <iframe id="iFrameTwo"  runat="server" style="width:100%;"  />
    </div>
</div>



This is the design of my page where i want to show to docs side by side.

Now what i want to create is two scroll bars , one vertical and the horizontal and when i scroll anyone of them, both docs will scroll at the same time.

I though of giving the "divMain" "overflow:auto" property and overflow:hidden to rest of the other controls. But when i run there are scrollbars for the iframe. The scrollbar belongs to a div inside the iframe having a id xxxx.

i don't know where the div came from. May be the its with in the doc that i am showing which is an infopath report.


What shall i do


Edit 16th July:-

I was able to hide the scroll bars and eventhough i have given the overflow of divMain to scroll, it is disabled.

Edit 17th July:-

I gave the parent div maxheight ( which i dnt thnk is nice due to resolution issue) , now scroll came for height.

Now i want the child control (iframe) content to get scrolled as i scroll the main div scroll

Thanks in advance


Arjun Menon

解决方案

(1) Add Jquery file for scroll event fire

(2) you have two ifmare in page right add this javascript code in your page

<script type="text/javascript" language="javascript">


(document).ready(function(){


(window.frames[0]).on('scroll', function() {


这篇关于为两个iframe创建常用卷轴的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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