I want to Set the Horizontal Scrollbar slider to the right without using css direction:"ltr" or dir="ltr" or an asp:Panel direction="rightToLeft"....
i just want to access the object that controls the Horizontal scrollbar slider to give it the position. from aspx page or the aspx.cs.
aspx pag开发者_运维知识库e :
<script type="text/javascript" src="../js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="../js/BeginScrollFromRight.js"></script> . . .
<body id="body" style="overflow:auto; height:100%;width:100%;"> . . . </body>
js page :
function BeginScrollFromRight()
{
$("#body").scrollLeft($(window).width());
}
I need to have the same effect for the direction:rtl but only for the horizontal scrollbar because other object are not supported when using direction:rtl
<td id="tdView" runat="server" dir="ltr" align="center">
<table onclick="hideMenusComplex();" oncontextmenu="hideMenusComplex();" id="tblView" runat="server">
<tr>
<td>
<asp:Label ID="lblView" runat="server" ForeColor="#5E82D6" Visible="false"><%= translate("View : ") %></asp:Label>
</td>
<td>
</td>
<td>
<cc1:Combobox AlignContainer="Center" ID="ddlViews" runat="server" OnClientChange="onChangeValue()"
FolderStyle="../EsStyles/ComboXpBlue" AutoPostbackEnable="false" Width ="200">
</cc1:Combobox>
</td>
<td>
<asp:Label ID="lblViewArabic" runat="server" ForeColor="#5E82D6" Visible="false"><%= translate("View : ") %></asp:Label>
</td>
</tr>
</table>
</td>
This is the code and the ddlViews is the dropdown list that is opening in a wrong way, the dropdown list is not opening under the control is opening on the left of the control.
For languages the read right-to-left, direction: rtl
is really the only way that will work well, in the end.
If you just want to scroll all the way to the right, jQuery JavaScript like:
$("#YourContentDiv").scrollLeft($("#YourContentDiv").width());
or:
$(window).scrollLeft($(window).width());
will do it.
.
In case you are new to jQuery, you can add it to your page, like this.:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
function jQueryMain ()
{
$("#YourContentDiv").scrollLeft($("#YourContentDiv").width());
$(window).scrollLeft($(window).width());
}
$(document).ready (jQueryMain);
</script>
.
PS: jQuery takes most of the cross-browser hassle out of JavaScript like this.
精彩评论