0

Am using the following code to load external in same page,in <div id="menu"> i have menu and when option is clicked external page will be loaded inside <div class="page"></div>

  • menu width is 25%
  • page is 70%

Now how do i change width of <div id="menu"> to 10% when external page is loaded

FULL CODE

<!DOCTYPE html>
   <html>
    <head>
        <meta charset="UTF-8">
        <title></title>
        <style>
            #menu{width:25%;background-color:beige;float: left}
            .page{width: 70%;height:200px;float: left;background-color: #99ffff}
        </style>
    </head>
    <body>
        <div class="container">
        <div class="box">                                        
            <div id="leftmenu">
                <ul id="leftmenuidfrmslt">
                    <li><span class="flaticon-smart"></span><text>&nbsp;&nbsp;Mobile & Tablet</text>
                        <ul>
                            <li><a class="reveal" href="postpage/mobile.php">&Xi;&nbsp;Mobile Phones</a></li>
                            <li><a class="reveal" href="postpage/tablet.php">&Xi;&nbsp;Tablets</a></li>
                            <li><a class="reveal" href="postpage/mobileaccessories.php">&Xi;&nbsp;Mobile Accessories</a></li>
                        </ul>
                    </li>
</div>
        <div class="page"></div>

        <script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
        <script type="text/javascript">
             $(document).ready(function() {
                $('.reveal').on('click', function(e) {
                    e.preventDefault();
                    var link = $(this).attr('href');
                    $('.page').load(link);
                    $('#leftmenu').css('width', '70px');
                    $("#leftmenu text").hide();
                    $('#leftmenu').off("click");
                    $(this).show();
                });
            });
        </script>
    </body>
</html>
1
  • did you try $("#menu").css("width","10%"); Commented Nov 17, 2014 at 7:54

1 Answer 1

1

change width using jquery css $('#menu').css('width', '10%');

$(document).ready(function() {

        $('.reveal').on('click', function(e) {
            e.preventDefault();
            var link = $(this).attr('href');
            $('.page').load(link);
            $('#menu').css('width', '10%');
            $(this).show();
        });
Sign up to request clarification or add additional context in comments.

13 Comments

how can i hide text inside that div alone
try this to hide text $('#menu').css('color', 'transparent');
Everything works fine i need to disable the entire div ,Hover effect and click ,,??
$('#menu').click(function() { $('#menu').hide(); }); to hide div
$('#menu').unbind('click'); to disable click in the div
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.