Click here to Skip to main content
15,888,272 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
my code is..
#MMainUploadDiv
      {
         position: relative;
      width: 900px;
      height: 300px;
     overflow-x:scroll;
      background-color:Red;
      }


      #MainUploadDiv
      {
        position: relative; visibility: visible; left: 0px; top: 0px; height:300px;


      }

       .ChildUploadDiv
      {
        background-color: White;
        height:270px;
        width:250px;
        float:left;
        margin:10px;
      }


html code is
<div id="MMainUploadDiv">
               <div id="MainUploadDiv">
              <div class="ChildUploadDiv"></div>
              <div class="ChildUploadDiv"></div>
              <div class="ChildUploadDiv"></div>
              <div class="ChildUploadDiv"></div>
               </div>
               </div>


but div is not added horizontal..i want horizotnal scroll bar to parent div...
Posted

1 solution

I usually use jQuery to overcome this problem (because I can see it's some kind of carousel):

HTML
<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js' type='text/javascript'></script>
<script type='text/javascript'>
   $(document).ready(function()
   {
      var w = 0;
      $("#MainUploadDiv .ChildUploadDiv").each(function(){ w += $(this).outerWidth(true); });
      $("#MainUploadDiv").css("width",w);
   });
</script>


Add this code just before tag.
Hope it helps you.

Regards,
Valy.
 
Share this answer
 
Comments
vishal_h 3-Dec-11 1:00am    
thank you...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900