Witam, mam problem chcę aby elementy były wyświetlane w jednej linii ( ten efekt już mi się udało zrobić) jednak div to traktuje tak jakby one były w osobnej linijce i robi strasznie duży odstęp między kolejnym divem

  1. <div id="galeria">
  2. <div id="main">
  3. <ul id="holder">
  4.  
  5. <li><a href="images/obrazki/straznica/12.jpg" class="highslide" onclick="return hs.expand(this)" alt="Strażnica OSP Wiśniowa"><img width="200" height="150" src="images/miniaturki/straznica/12.jpg" alt="Strażnica OSP Wiśniowa" /></a></li>
  6. <li><a href="images/obrazki/straznica/13.jpg" class="highslide" onclick="return hs.expand(this)" alt="Strażnica OSP Wiśniowa"><img width="200" height="150" src="images/miniaturki/straznica/13.jpg" alt="Strażnica OSP Wiśniowa" /></a></li>
  7.  
  8. </ul>
  9. </div>
  10.  
  11. <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
  12. <script type="text/javascript" src="js/script.js"></script>
  13. </div>


  1. #main{
  2. position:relative;
  3. width:710px;
  4. margin-bottom: 30px;
  5. }
  6.  
  7. #holder{
  8. height: 700px;
  9. width:710px;
  10. overflow:hidden;
  11. position:relative;
  12. }
  13.  
  14. .swControls{
  15. position:absolute;
  16. }
  17.  
  18. a.swShowPage{
  19.  
  20. /* The links that initiate the page slide */
  21. background-color:#444444;
  22. float:left;
  23. height:15px;
  24. margin:4px 3px;
  25. text-align: center;
  26. width:15px;
  27. }
  28.  
  29. a.swShowPage:hover,
  30. a.swShowPage.active{
  31. background-color:#2993dd;
  32. }
  33. #holder,
  34. #holder li{
  35. }
  36.  
  37. #galeria{
  38. margin: 0 0 0 25px;
  39. font: 12px Arial, Verdana;
  40. }
  41.  
  42. #galeria ul li{
  43. display: inline-block;
  44. list-style-type:none;
  45. text-decoration:none;
  46.  
  47. }


  1. (function($){
  2.  
  3. // Creating the sweetPages jQuery plugin:
  4. $.fn.sweetPages = function(opts){
  5.  
  6. // If no options were passed, create an empty opts object
  7. if(!opts) opts = {};
  8.  
  9. var resultsPerPage = opts.perPage || 12;
  10.  
  11. // The plugin works best for unordered lists, althugh ols would do just as well:
  12. var ul = this;
  13. var li = ul.find('li');
  14.  
  15. li.each(function(){
  16. // Calculating the height of each li element, and storing it with the data method:
  17. var el = $(this);
  18. el.data('height',el.outerHeight(true));
  19. });
  20.  
  21. // Calculating the total number of pages:
  22. var pagesNumber = Math.ceil(li.length/resultsPerPage);
  23.  
  24. // If the pages are less than two, do nothing:
  25. if(pagesNumber<2) return this;
  26.  
  27. // Creating the controls div:
  28. var swControls = $('<div class="swControls">');
  29.  
  30. for(var i=0;i<pagesNumber;i++)
  31. {
  32. // Slice a portion of the lis, and wrap it in a swPage div:
  33. li.slice(i*resultsPerPage,(i+1)*resultsPerPage).wrapAll('<div class="swPage" />');
  34.  
  35. // Adding a link to the swControls div:
  36. swControls.append('<a href="" class="swShowPage">'+(i+1)+'</a>');
  37. }
  38.  
  39. ul.append(swControls);
  40.  
  41. var maxHeight = 0;
  42. var totalWidth = 0;
  43.  
  44. var swPage = ul.find('.swPage');
  45. swPage.each(function(){
  46.  
  47. // Looping through all the newly created pages:
  48.  
  49. var elem = $(this);
  50.  
  51. var tmpHeight = 0;
  52. elem.find('li').each(function(){tmpHeight+=$(this).data('height');});
  53.  
  54. if(tmpHeight>maxHeight)
  55. maxHeight = tmpHeight;
  56.  
  57. totalWidth+=elem.outerWidth();
  58.  
  59. elem.css('float','left').width(ul.width());
  60. });
  61.  
  62. swPage.wrapAll('<div class="swSlider" />');
  63.  
  64. // Setting the height of the ul to the height of the tallest page:
  65. ul.height(maxHeight);
  66.  
  67. var swSlider = ul.find('.swSlider');
  68. swSlider.append('<div class="clear" />').width(totalWidth);
  69.  
  70. var hyperLinks = ul.find('a.swShowPage');
  71.  
  72. hyperLinks.click(function(e){
  73.  
  74. // If one of the control links is clicked, slide the swSlider div
  75. // (which contains all the pages) and mark it as active:
  76.  
  77. $(this).addClass('active').siblings().removeClass('active');
  78.  
  79. swSlider.stop().animate({'margin-left':-(parseInt($(this).text())-1)*ul.width()},'slow');
  80. e.preventDefault();
  81. });
  82.  
  83. // Mark the first link as active the first time this code runs:
  84. hyperLinks.eq(0).addClass('active');
  85.  
  86. // Center the control div:
  87. swControls.css({
  88. 'left':'50%',
  89. 'margin-left':-swControls.width()/2
  90. });
  91.  
  92. return this;
  93.  
  94. }})(jQuery);
  95.  
  96.  
  97. $(document).ready(function(){
  98. /* The following code is executed once the DOM is loaded */
  99.  
  100. // Calling the jQuery plugin and splitting the
  101. // #holder UL into pages of 3 LIs each:
  102.  
  103. $('#holder').sweetPages({perPage:12});
  104.  
  105. // The default behaviour of the plugin is to insert the
  106. // page links in the ul, but we need them in the main container:
  107.  
  108. var controls = $('.swControls').detach();
  109. controls.appendTo('#main');
  110.  
  111. });