2 javascript jquery jquery-ui right-to-left jquery-events
我想dir在页面加载后更改 HTML 属性;我怎样才能做到这一点?我需要使用该.ready()功能吗?目前它看起来像:
jQuery("html[lang=ar]").attr("dir", "rtl")
.find("body").addClass("right-to-left");
Run Code Online (Sandbox Code Playgroud)
我怎样才能把它写在脚本中?我需要写在.ready()函数中还是.load()?
<div class="header">
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script>
jQuery("html").attr("dir", "rtl")?
</script>
Run Code Online (Sandbox Code Playgroud)
代码如下所示:
这是我的 CSS
body.right-to-left li {
float:right;
direction: rtl;
}
Run Code Online (Sandbox Code Playgroud)
尽可能简单...
将您的代码放入... document.ready()
<script>
$(document).ready(function(){
$("html[lang=ar]").attr("dir", "rtl")
.find("body").addClass("right-to-left");
});
</script>
Run Code Online (Sandbox Code Playgroud)
以及一个解释ready()和load()功能的链接..
http://4loc.wordpress.com/2009/04/28/documentready-vs-windowload/