无法正确滑动图像

时间:2015-09-15 07:33:07

标签: jquery html laravel laravel-5

我用laravel制作了一个简单的网站5.我需要动态地滑动图像,但它会滑动另一个div而不是图像,请帮助我 我的实际

html代码

 <section class="clients">
         <div class="container">
           <div class="row">
             <div class="col-md-8">
             <p class="clients_head">Alliances</p>
               <div id="carousel-example-generic2" class="carousel slide" data-ride="carousel">
                 <!-- Wrapper for slides -->
                  <div class="carousel-inner inner" role="listbox">
                    <div class="item active">
                      <div class="col-sm-1 col-md-offset-1 col-md-1 client_img">
                        <img src="images/gic.png">
                      </div>
                      <div class="col-sm-3 col-md-3">
                        <img src="images/unitedindia.png">
                      </div>
                      <div class="col-sm-3 col-md-3">
                        <img src="images/avgen.png">
                      </div>
                      <div class="col-sm-3 col-md-3">
                        <img src="images/oman.png">
                      </div>
                    </div>
                    <div class="item">
                      <div class="col-sm-1 col-md-offset-1 col-md-1 client_img">
                        <img src="images/gic.png">
                      </div>
                      <div class="col-sm-3 col-md-3">
                        <img src="images/unitedindia.png">
                      </div>
                      <div class="col-sm-3 col-md-3">
                        <img src="images/avgen.png">
                      </div>
                      <div class="col-sm-3 col-md-3">
                        <img src="images/oman.png">
                      </div>
                    </div>

                  </div>

                  <!-- Controls -->
                  <a class="left carousel-control arow" href="#carousel-example-generic2" role="button" data-slide="prev">
                    <img src="css/images/arrw-left.png">
                  </a>
                  <a class="right carousel-control arow1" href="#carousel-example-generic2" role="button" data-slide="next">
                    <img src="css/images/arrw-right.png">
                  </a>
                </div>
             </div>
             <div class="col-md-1">
              <p class="clients_head">Forex</p>
             </div>
             <div class="col-md-3"> 
              <div class="forex">
                <table>
               <tbody>
                   <tr>
                    <th>Currency</th>
                    <th>Buying</th>
                    <th>Selling</th>
                   </tr>
                   <tr>
                    <td>EUR</td>
                    <td>95</td>
                    <td>95.95</td>
                   </tr>
                   <tr>
                    <td>JPY</td>
                    <td>0.8706</td>
                    <td>0.8793</td>
                   </tr>
                   <tr>
                    <td>AUD</td>
                    <td>72.49</td>
                    <td>73.21</td>
                   </tr>
                   <tr>
                    <td>CAD</td>
                    <td>70.93</td>
                    <td>71.64</td>
                   </tr>
                   <tr>
                   <td colspan="3" class="exchange">For more exchange rate <a href="#" class="link">click here</a></td>
                   </tr>
                </tbody>   
              </table>
              </div>
             </div>
           </div>
         </div>
       </section><!--clients end-->
    </div>    

我的动态视图代码

<section class="clients">
         <div class="container">
           <div class="row">
             <div class="col-md-8">
             <p class="clients_head">Alliances</p>
               <div id="carousel-example-generic2" class="carousel slide" data-ride="carousel">
                 <!-- Wrapper for slides -->
                  <div class="carousel-inner inner" role="listbox">
                  @if(isset($allinaces))
                       @foreach($allinaces as $alliance)
                       @if(count($alliance)==0)
                    <div class="item active">

                    </div>
                   @else
                    <div class="item">
                    @endif
                      <div class="col-sm-3 col-md-3">
                        <img src="backend/alliances/{{$alliance->image}}">
                      </div>

                    </div>

                  </div>

                @endforeach
                @endif
                  <!-- Controls -->
                  <a class="left carousel-control arow" href="#carousel-example-generic2" role="button" data-slide="prev">
                    <img src="css/images/arrw-left.png">
                  </a>
                  <a class="right carousel-control arow1" href="#carousel-example-generic2" role="button" data-slide="next">
                    <img src="css/images/arrw-right.png">
                  </a>
                </div>
             </div>
             <div class="col-md-1">
              <p class="clients_head">Forex</p>
             </div>
             <div class="col-md-3"> 
              <div class="forex">
                <table>
               <tbody>
                   <tr>
                    <th>Currency</th>
                    <th>Buying</th>
                    <th>Selling</th>
                   </tr>
                   <tr>
                    <td>EUR</td>
                    <td>95</td>
                    <td>95.95</td>
                   </tr>
                   <tr>
                    <td>JPY</td>
                    <td>0.8706</td>
                    <td>0.8793</td>
                   </tr>
                   <tr>
                    <td>AUD</td>
                    <td>72.49</td>
                    <td>73.21</td>
                   </tr>
                   <tr>
                    <td>CAD</td>
                    <td>70.93</td>
                    <td>71.64</td>
                   </tr>
                   <tr>
                   <td colspan="3" class="exchange">For more exchange rate <a href="#" class="link">click here</a></td>
                   </tr>
                </tbody>   
              </table>
              </div>
             </div>
           </div>
         </div>
       </section><!--clients end-->

我认为错误是因为我无法在正确的div中使用@if和@else。我花了很多时间但无法解决它,希望你们帮助我。

1 个答案:

答案 0 :(得分:1)

是否在If else条件下出错。我做了一些改变 码。希望它能奏效。

<section class="clients">
         <div class="container">
           <div class="row">
             <div class="col-md-8">
             <p class="clients_head">Alliances</p>
               <div id="carousel-example-generic2" class="carousel slide" data-ride="carousel">
                 <!-- Wrapper for slides -->
                  <div class="carousel-inner inner" role="listbox">
                  @if(isset($allinaces))
                       @foreach($allinaces as $alliance)
                       @if(count($alliance)==0)
                    <div class="item active">
                        <div class="col-sm-1 col-md-offset-1 col-md-1 client_img">
                          <img src="images/gic.png">
                        </div>
                         <div class="col-sm-3 col-md-3">
                          <img src="images/unitedindia.png">
                        </div>
                        <div class="col-sm-3 col-md-3">
                          <img src="images/avgen.png">
                        </div>
                        <div class="col-sm-3 col-md-3">
                          <img src="images/oman.png">
                        </div>
                     </div>
                   @else
                    <div class="item">
                        <div class="col-sm-3 col-md-3">
                          <img src="backend/alliances/{{$alliance->image}}">
                        </div>
                        <div class="col-sm-3 col-md-3">
                          <img src="images/unitedindia.png">
                         </div>
                        <div class="col-sm-3 col-md-3">
                          <img src="images/avgen.png">
                        </div>
                        <div class="col-sm-3 col-md-3">
                          <img src="images/oman.png">
                        </div>
                    </div>
                    @endif

                @endforeach
                @endif
                </div>

                  <!-- Controls -->
                  <a class="left carousel-control arow" href="#carousel-example-generic2" role="button" data-slide="prev">
                    <img src="css/images/arrw-left.png">
                  </a>
                  <a class="right carousel-control arow1" href="#carousel-example-generic2" role="button" data-slide="next">
                    <img src="css/images/arrw-right.png">
                  </a>
                </div>
             </div>
             <div class="col-md-1">
              <p class="clients_head">Forex</p>
             </div>
             <div class="col-md-3"> 
              <div class="forex">
                <table>
               <tbody>
                   <tr>
                    <th>Currency</th>
                    <th>Buying</th>
                    <th>Selling</th>
                   </tr>
                   <tr>
                    <td>EUR</td>
                    <td>95</td>
                    <td>95.95</td>
                   </tr>
                   <tr>
                    <td>JPY</td>
                    <td>0.8706</td>
                    <td>0.8793</td>
                   </tr>
                   <tr>
                    <td>AUD</td>
                    <td>72.49</td>
                    <td>73.21</td>
                   </tr>
                   <tr>
                    <td>CAD</td>
                    <td>70.93</td>
                    <td>71.64</td>
                   </tr>
                   <tr>
                   <td colspan="3" class="exchange">For more exchange rate <a href="#" class="link">click here</a></td>
                   </tr>
                </tbody>   
              </table>
              </div>
             </div>
           </div>
         </div>
       </section><!--clients end-->