2016-06-24 2 views
1

3列から始まるグリッドに表示する必要のあるピクチャのページで作業しています。しかし、ページが読み込まれるたびに、写真はページの左側にまっすぐ進む1列として読み込まれます。写真ページの読み込みがグリッドである場合のアライメント

ブラウザを一度伸ばすだけで、写真が再調整されます。

ページが読み込まれるとすぐに3列のグリッドに表示します。

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"></script> 
 
    <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script> 
 
    
 
    
 
    
 

 
    <script type="{{site.baseurl}}/js/scrollspy.js"></script> 
 
    <script src="swipebox/lib/jquery-1.9.0.js"></script> 
 
    <script type="text/javascript" src="js/modernizr.custom.js"></script> 
 
    <script src="swipebox/lib/ios-orientationchange-fix.js"></script> 
 
    <script src="swipebox/lib/jquery-2.1.0.min.js"></script> 
 
    <script type="text/javascript" src="js/jquery-1.9.0.js"></script> 
 

 
    <script src="http://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js"></script> 
 
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"></script> 
 

 
    <script> 
 
       //When the DOM document is loaded in the browser 
 

 
      $(document).ready(function() { 
 
     
 
    
 
    
 
    
 
     <!-- jQuery --> 
 
    <script src="js/jquery.js"></script> 
 

 
    <!-- Bootstrap Core JavaScript --> 
 
    <script src="js/bootstrap.min.js"></script> 
 

 
    <!-- Custom Theme JavaScript --> 
 
    <script type="text/javascript"> 
 
    $("#menu-close").click(function(e) { 
 
     e.preventDefault(); 
 
     $("#sidebar-wrapper").toggleClass("active"); 
 
\t \t $("#menu-toggle").show("active"); 
 
\t \t $("#menu-close").hide("active"); 
 
\t \t 
 

 
    }); 
 

 
    // Opens the sidebar menu 
 
    $("#menu-toggle").click(function(e) { 
 
     e.preventDefault(); 
 
     $("#sidebar-wrapper").toggleClass("active"); 
 
\t \t $("#menu-close").show("active"); 
 
\t \t $("#menu-toggle").hide("active"); 
 
\t \t 
 
\t \t 
 
\t \t 
 
    }); 
 

 

 
    // Closes the sidebar menu 
 
    $("#menu-close2").click(function(e) { 
 
     e.preventDefault(); 
 
     $("#sidebar-wrapper2").toggleClass("active")//slideUp(50); 
 
    }); 
 

 
    // Opens the sidebar menu 
 
    $("#menu-toggle2").click(function(e) { 
 
     e.preventDefault(); 
 
     $("#sidebar-wrapper2").toggleClass("active")//slideDown(50); 
 
    }); 
 

 
    /* Basic Gallery */ 
 
      
 
      
 
    
 
     
 
</script> 
 
<script type="text/javascript"> 
 
    // Scrolls to the selected menu item on the page 
 
    $(function() { 
 
     $('a[href*=#]:not([href=#])').click(function() { 
 
      if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') || location.hostname == this.hostname) { 
 

 
       var target = $(this.hash); 
 
       target = target.length ? target : $('[name=' + this.hash.slice(1) + ']'); 
 
       if (target.length) { 
 
        $('html,body').animate({ 
 
         scrollTop: target.offset().top 
 
        }, 1000); 
 
        return false; 
 
       } 
 
      } 
 
     }); 
 
    }); 
 
    </script> 
 

 
    
 

 
        <script src="bower_components/metisMenu/dist/metisMenu.min.js"></script> 
 
    <!-- Plugin JavaScript --> 
 
    <script src="http://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js"></script> 
 

 
     <!-- jQuery --> 
 
    <script src="js/jquery.js"></script> 
 

 
    <!-- Bootstrap Core JavaScript --> 
 
    <script src="js/bootstrap.min.js"></script> 
 

 
    <!-- Plugin JavaScript --> 
 
    <script src="http://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js"></script> 
 
    <script src="js/classie.js"></script> 
 
    <script src="js/cbpAnimatedHeader.js"></script> 
 

 
    <!-- Contact Form JavaScript --> 
 
    <script src="js/jqBootstrapValidation.js"></script> 
 
    <script src="js/contact_me.js"></script> 
 
    
 

 
    <!-- Custom Theme JavaScript --> 
 
    <script src="js/agency.js"></script> 
 

 
     
 
<script src="lib/ios-orientationchange-fix.js"></script> 
 
    <script src="lib/jquery-2.1.0.min.js"></script> 
 
    <script src="js/jquery.swipebox.js"></script> 
 

 
<!-- <script type="text/javascript" src="js/SmoothScroll.js"></script> 
 
--> <script type="text/javascript" src="js/jquery.isotope.js"></script> 
 
\t 
 
    <script type="text/javascript"> 
 
jQuery(function($) { 
 
    $(".swipebox").swipebox(); 
 
}); 
 
</script> 
 

 

 

 

 
\t <!-- 
 
<script type="text/javascript"> 
 
    $(document).ready(function() { 
 

 
      /* Basic Gallery */ 
 
      $('.swipebox').swipebox(); 
 
      
 
      /* Video */ 
 
      $('.swipebox-video').swipebox(); 
 

 
      /* Dynamic Gallery */ 
 
      $('#gallery').click(function(e) { 
 
       e.preventDefault(); 
 
       $.swipebox([ 
 
        { href : 'http://swipebox.csag.co/mages/image-1.jpg', title : 'My Caption' }, 
 
        { href : 'http://swipebox.csag.co/images/image-2.jpg', title : 'My Second Caption' } 
 
       ]); 
 
      }); 
 

 
     }); 
 
    </script> 
 
    --> 
 
<!-- <script type="text/javascript" src="js/main.js"></script> --> 
 
<script src="js/owl.carousel.js"></script> 
 
<!-- <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.2/jquery.min.js'></script> 
 
--><script src='http://npmcdn.com/[email protected]/dist/isotope.pkgd.js'></script> 
 

 
<script src="js/index.js"></script>
<link href="font-awesome/fonts/plugin.css" rel="stylesheet" type="text/css"> 
 
    <link href="font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css"> 
 
    <link href="css/plugin.css" rel="stylesheet" type="text/css"> 
 
<link href="css/bootstrap.min.css" rel="stylesheet"> 
 
    <link href="css/bootstrap.css" rel="stylesheet" type="text/css"> 
 

 
    <!-- Custom CSS --> 
 

 
    <link rel="stylesheet" href="demo/normalize.css"> 
 
    <link rel="stylesheet" href="demo/bagpakk.min.css"> 
 
    <link rel="stylesheet" href="src/css/swipebox.css"> 
 
    <link rel="stylesheet" href="css/stylish-portfolio.css"> 
 
    <link rel="stylesheet" href="css/style.css"> 
 
    
 
    <link rel="stylesheet" href="swipebox/src/css/swipebox.css"> 
 
    <link rel="stylesheet" href="swipebox/src/css/swipebox.min.css"> 
 
    <link rel="stylesheet" href="swipebox/demo/normalize.css"> 
 
    <link rel="stylesheet" href="swipebox/demo/bagpakk.min.css"> 
 
    <link rel="stylesheet" href="swipebox/demo/style.css"> 
 
    
 
    <link rel="stylesheet" href="css/owl.carousel.css" media="screen"> 
 
    <link rel="stylesheet" href="css/owl.theme.css"media="screen"> 
 
    
 

 
    <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<section id="portfolio" class="portfolio" style="display: none;" > 
 
      <div class="container"> 
 
    
 
       <div class="row"> 
 
       <div class="col-lg-12 col-md-12 text-center"> 
 
        <h2><font style="text-transform: uppercase;"face="Helvetica" >Portfolio</font></h2> 
 
        <hr class="large"> 
 
       </div> 
 
       </div> 
 
        
 
<div class="button-group filters-button-group"> 
 
    <button class="button is-checked" data-filter="*">show all</button> 
 
    <button class="button" data-filter=".ling">Lingeria</button> 
 
    <button class="button" data-filter=".men">Men</button> 
 
    <button class="button" data-filter=".women">Women</button> 
 
</div> 
 
        
 
<div class="grid"> 
 
    <div class="element-item men " data-category="men"> 
 
    
 
    <img class="img-portfolio img-responsive" src="img/1.jpg" style="width: 300px; height: 300px;"> 
 
    
 
    </div> 
 
    
 
    <div class="element-item ling" data-category="ling"> 
 
    <img class="img-portfolio img-responsive" src="img/2.jpg" style="width: 300px; height: 300px;"> 
 
    
 
    </div> 
 
    
 
    <div class="element-item men" data-category="men"> 
 
    <img class="img-portfolio img-responsive" src="img/3.jpg" style="width: 300px; height: 300px;"> 
 
    
 
    </div> 
 
    
 
    
 
    <div class="element-item women" data-category="women"> 
 
    <img class="img-portfolio img-responsive" src="img/4.jpg" style="width: 300px; height: 300px;"> 
 
    
 
    </div> 
 
    
 
    <div class="element-item ling " data-category="ling"> 
 
    <img class="img-portfolio img-responsive" src="img/5.jpg" style="width: 300px; height: 300px;"> 
 
    
 
    </div> 
 
</div> 
 
     </div> 
 
    </section>

答えて

0

Document.ready()の終わりにこれを追加します。

$(window).resize() 

私はそれが動作するはずだと思う、それは変更をトリガーする必要のあるブラウザにresizeイベントを呼び出します。

Ps:あなたのページにロードしたJqueryのすべてのバージョンをすべて削除することをお勧めします。

+0

どこに入れていますか?私はこのようにそれを置くが、それはまだdoesntの仕事: $(ドキュメント).ready(関数(){ \t \t \t \t \t \t $(ウィンドウ).resize(); – BravoKiloTango

+0

たぶん次のリンクを助けることができます: http://stackoverflow.com/questions/17264269/jquery-fluid-isotope-only-working-after-resize –

関連する問題