Iframe滚动条向右对齐 [英] Iframe scrollbar align to right

查看:119
本文介绍了Iframe滚动条向右对齐的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有一种方法可以将iframe中的滚动条与右对齐吗?其默认为左。

任何想法?


看看这里我想在加载页面时看到搜索框!



我有一个应用程序有一个ifram,在ifram中,我正在加载一个网站,搜索框在右上角,我希望当页面加载时我应该能够看到搜索你可以使用jquery吗?你可以使用jquery吗?你可以使用jquery吗?你可以使用jquery吗?如果是,您可以执行以下操作:

 <!DOCTYPE html> 
< html>
< head>
< script src =http://code.jquery.com/jquery-latest.js>< / script>
< / head>
< body>
< p>这是一些文字。这是一些文字。这是一些文字。
< div id =framestyle =width:200px; height:200px; overflow:scroll;>
< iframe src =http://www.w3schools.com/default.aspwidth =1024height =768scrolling =no>
< p>您的浏览器不支援iframe。< / p>
< / iframe>
< / div>
这是一些文字。这是一些文字。这是一些文字。< / p>

align属性在HTML 4中被弃用,并且在HTML 4.01 Strict DTD或XHTML 1.0 Strict DTD中不受支持。使用CSS代替。< / p>
< script type =text / javascript>
jQuery(document).ready(function(){
$(#frame)。scrollTop(10).scrollLeft(750);
});
< / script>
< / body>
< / html>

如果您将代码复制并粘贴到html文件并在浏览器中打开,看到iframe自动滚动到最右边。



关键更改为:


  1. 在您的html文件中导入jquery

    li>
  2. 在您的iframe中添加滚动=no

  3. 指定iframe的宽度和高度,它应该与实际宽度&嵌入式页面的高度

  4. 将iframe包装在< div> 中,确保指定宽度&高度(小于iframe宽度和高度)

  5. 在关闭之前添加JavaScript代码< / body> 标记

    < script type =text / javascript>
    jQuery(document).ready(function(){
    $(#frame)。scrollTop(10).scrollLeft(800);
    });
    < / script>



There is a way to align the scroll bar from an iframe to right? its by default to left.
any idea?

take a look here i wanna see the search box when i load the page!

i have an application that has an ifram, in the ifram I'm loading a website that the search box is on the upper right,
and i want that when the page loads i should be able to see the search box right away without having to scroll to the right.... something not clear?

解决方案

can you use jquery? if yes, you can do the following:

<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-latest.js"></script>
</head>
<body>
<p>This is some text. This is some text. This is some text.
<div id="frame" style="width: 200px; height: 200px; overflow: scroll";>
<iframe src="http://www.w3schools.com/default.asp" width="1024" height="768" scrolling="no">
<p>Your browser does not support iframes.</p>
</iframe>
</div>
This is some text. This is some text. This is some text.</p>
<p>The align attribute was deprecated in HTML 4, and is not supported in HTML 4.01 Strict DTD or in XHTML 1.0 Strict DTD. Use CSS instead.</p>
<script type="text/javascript">
jQuery(document).ready(function () {
$("#frame").scrollTop(10).scrollLeft(750);
});
</script>
</body>
</html>

If you copy and paste the code into a html file and open it in your browser, you'll see that the iframe is automatically scroll to the very right.

The key changes are:

  1. import jquery in your html file
  2. add scrolling="no" to your iframe
  3. specify the width and height of your iframe, it should be roughly the same as the actualy width & height of the embedded page
  4. wrap your iframe in a <div>, be sure to specify the width & height (less than the iframe width & height)
  5. add the javascript code before the closing </body> tag

    <script type="text/javascript"> jQuery(document).ready(function () { $("#frame").scrollTop(10).scrollLeft(800); }); </script>

这篇关于Iframe滚动条向右对齐的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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