Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
635
change css element of websplitter by javascript
posted

i want to change the css element left of websplitter  from 0px to 20px by javascript.i have tried splitter.css('left','20px'); but its not working.

  • 24497
    Verified Answer
    posted

    Hi Prajakta,

    I do not know why changing style attributes of splitter does not work in your application. It is possible that you use wrong html element or misuse DOM attributes. For example, top-level attributes should be applied to outer DIV element used by WebSplitter, and style.left has no effect until application sets style.position.
    The best approach is to use public properties of WebSplitter. In this case you will not need to learn how to handle javascript objects exposed by splitter. Below is preffered approach:

    <style type="text/css">
     
    .pos { left: 200px; top: 100px; position: absolute; }
    </style>
    <ig:WebSplitter ... CssClass="pos">

    If you do not want any configuration on server and do everything manually on client, then I suggest you to look at CSOM documentation of WebSplitter, or at least look at structure of generated html. Javascript debugger would be useful as well. Below are codes to change style.left attribute of splitter using jquery.

    <script type="text/javascript">
     
    function changePos() {
      
    // prefferable search
      
    var div = $($find("WebSplitter1").get_element());
      
    // commented line: unreliable search
      
    //div = $("#WebSplitter1");
      
    div.css({left: '200px', top: '200px', position: 'absolute'});
    }
    </script>
    <input type="button" value="change pos" onclick="changePos()" />