2012-05-01 13 views
0

ページ上の複数のスライダに問題があります。1つのページに複数のjqueryスライダを配置する

スライダー:現在、私はjQueryを使って外部のhtmlからスライダーを含めていますhttp://landofcoder.com/jquery-plugins/lof-jslidernew-plugin.html

<script src="js/jquery.js"></script> 

<script type="text/javascript"> 
function loadslide1() 
{ 
    $("#includeslider1").load("slider1.html"); 
} 
function loadslide2() 
{ 
    $("#includeslider2").load("slider2.html"); 
} 
</script> 


<style type="text/css"> 
body {width:900px; height: 600px; background-color: black;} 
</style> 

    </head> 
    <body> 

    <div id="includeslider1"></div> 
    <script>loadslide1()</script> 
    <div id="includeslider2"></div> 
    <script>loadslide2()</script> 

    </body> 

slider1コード:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 


<!-- Slider --> 
<link rel="stylesheet" type="text/css" href="css/lofc-layout.css" /> 
<link rel="stylesheet" type="text/css" href="css/lofc-style2.css" /> 
<script language="javascript" type="text/javascript" src="js/jquery.js"></script> 
<script language="javascript" type="text/javascript" src="js/jquery.easing.js"></script> 
<script language="javascript" type="text/javascript" src="js/script.js"></script> 
<script type="text/javascript"> 
$(document).ready(function(){ 
     var buttons = { previous:$('#jslidernews2 .button-previous') , 
         next:$('#jslidernews2 .button-next') };   
     $('#jslidernews2').lofJSidernews({ interval:5000, 
               easing:'easeInOutQuad', 
               duration:1200, 
               auto:true, 
               mainWidth:684, 
               mainHeight:300, 
               navigatorHeight  : 100, 
               navigatorWidth  : 310, 
               maxItemDisplay:3, 
               buttons:buttons });       
    }); 

</script> 
<style> 

    ul.lof-main-wapper li { 
     position:relative; 
    } 
</style> 
<!-- Slider --> 
</head> 
<body> 


<!------------------------------------- THE CONTENT -------------------------------------------------> 
<div id="jslidernews2" class="lof-slidecontent" style="width:980px; height:300px;"> 
    <div class="preload"><div></div></div> 


      <div class="button-previous">Previous</div> 

      <!-- MAIN CONTENT --> 
       <div class="main-slider-content" style="width:684px; height:300px;"> 
       <ul class="sliders-wrap-inner"> 
        <li> 
          <img src="images/thumbl_980x340.png" title="Newsflash 2" >   
          <div class="slider-description"> 
          <div class="slider-meta"><a target="_parent" title="Newsflash 1" href="#Category-1">/ Newsflash 1 /</a> <i> — Monday, February 15, 2010 12:42</i></div> 
          <h4>Content of Newsflash 1</h4> 
          <p>The one thing about a Web site, it always changes! Joomla! makes it easy to add Articles, content,... 
          <a class="readmore" href="#">Read more </a> 
          </p> 
         </div> 
        </li> 
        <li> 
         <img src="images/thumbl_980x340_002.png" title="Newsflash 1" >   
         <div class="slider-description"> 
          <div class="slider-meta"><a target="_parent" title="Newsflash 2" href="#Category-2">/ Newsflash 2 /</a> <i> — Monday, February 15, 2010 12:42</i></div> 
          <h4>Content of Newsflash 2</h4> 
          <p>Joomla! makes it easy to launch a Web site of any kind. Whether you want a brochure site or you are... 
          <a class="readmore" href="#">Read more </a> 
          </p> 
         </div> 
        </li> 
        <li> 
         <img src="images/thumbl_980x340_003.png" title="Newsflash 3" >    
         <div class="slider-description"> 
          <div class="slider-meta"><a target="_parent" title="Newsflash 3" href="#Category-3">/ Newsflash 3 /</a> <i> — Monday, February 15, 2010 12:42</i></div> 
          <h4>Content of Newsflash 3</h4> 
          <p>With a library of thousands of free Extensions, you can add what you need as your site grows. Don't... 
          <a class="readmore" href="#">Read more </a> 
          </p> 
         </div> 
        </li> 
        <li> 
         <img src="images/thumbl_980x340_004.png" title="Newsflash 5" >    
         <div class="slider-description"> 
          <div class="slider-meta"><a target="_parent" title="Newsflash 4" href="#Category-4">/ Newsflash 4 /</a> <i> — Monday, February 15, 2010 12:42</i></div> 
          <h4>Content of Newsflash 4</h4> 
          <p>Joomla! 1.5 - 'Experience the Freedom'!. It has never been easier to create your own dynamic Web... 
          <a class="readmore" href="#">Read more </a> 
          </p> 
         </div> 
        </li> 
        <li> 
         <img src="images/thumbl_980x340_005.png" title="Newsflash 5" >    
         <div class="slider-description"> 
          <div class="slider-meta"><a target="_parent" title="Newsflash 5" href="#">/ Newsflash 5 /</a> <i> — Monday, February 15, 2010 12:42</i></div> 
          <h4>Content of Newsflash 5</h4> 
          <p>Joomla! 1.5 - 'Experience the Freedom'!. It has never been easier to create your own dynamic Web... 
          <a class="readmore" href="#">Read more </a> 
          </p> 
         </div> 
        </li> 
        <li> 

         <img src="images/thumbl_980x340_006.png" title="Newsflash 5" >    
         <div class="slider-description"> 
          <div class="slider-meta"><a target="_parent" title="Newsflash 6" href="#">/ Newsflash 6 /</a> <i> — Monday, February 15, 2010 12:42</i></div> 
          <h4>Content of Newsflash 6</h4> 
          <p>Joomla! 1.5 - 'Experience the Freedom'!. It has never been easier to create your own dynamic Web... 
          <a class="readmore" href="#">Read more </a> 
          </p> 
         </div> 
        </li> 

        </ul>  
      </div> 
      <!-- END MAIN CONTENT --> 
      <!-- NAVIGATOR --> 
      <div class="navigator-content"> 
        <div class="navigator-wrapper"> 
         <ul class="navigator-wrap-inner"> 
          <li> 
           <div> 
            <img src="images/lofthumbs/791902news3.jpg" /> 
            <h3> NewsFlash 1 </h3> 
            <span>20.01.2010</span> - In id, mauris viverra asperiores, bibendum in id. Eu molestie. Ac sit eu... 
           </div>  
          </li> 
          <li> 
           <div> 
            <img src="images/lofthumbs/435576news10.jpg" /> 
            <h3> NewsFlash 2 </h3> 
            <span>20.01.2010</span> -In id, mauris viverra asperiores, bibendum in id. Eu molestie. Ac sit eu. .. 
           </div>  
          </li> 

          <li> 
           <div> 
            <img src="images/lofthumbs/641906img1.jpg" /> 
            <h3> NewsFlash 3 </h3> 
            <span>20.01.2010</span> - In id, mauris viverra asperiores, bibendum in id. Eu molestie. Ac sit eu. .. 
           </div>  
          </li> 

          <li> 
           <div> 
            <img src="images/lofthumbs/416719news7.jpg" /> 
            <h3> NewsFlash 4</h3> 
            <span>20.01.2010</span> - In id, mauris viverra asperiores, bibendum in id. Eu molestie. Ac sit eu. .. 
           </div> 
          </li>  
          <li> 
           <div> 
            <img src="images/lofthumbs/641906img1.jpg" /> 
            <h3> NewsFlash 5</h3> 
            <span>20.01.2010</span> -In id, mauris viverra asperiores, bibendum in id. Eu molestie. Ac sit eu. .. 
           </div> 
          </li> 
          <li> 
           <div> 
            <img src="images/lofthumbs/416719news7.jpg" /> 
            <h3> NewsFlash 6</h3> 
            <span>20.01.2010</span> - In id, mauris viverra asperiores, bibendum in id. Eu molestie. Ac sit eu. .. 
           </div> 
          </li>   
         </ul> 
        </div> 

      </div> 
      <!----------------- END OF NAVIGATOR ---------------------> 
      <div class="button-next">Next</div> 

     <!-- BUTTON PLAY-STOP --> 
      <div class="button-control"><span></span></div> 
      <!-- END OF BUTTON PLAY-STOP --> 

<!------------------------------------- END OF THE CONTENT -------------------------------------------------> 



    </div> 
</body> 
</html> 

スライダー2は、IDに変更を除いて同じですそれらをユニークにする。

大規模なコードダンプは残念ですが、何が起こっているのかを確認する必要があります。

すべてのヘルプや提案大いに受け...

あなたがそうであるように、私は同じ問題が発生した

+0

あなたの問題は何ですか? – CambridgeMike

+0

私は両方のスライダを動かすことはできません...一方は、他のスライダを破る。または、少なくとも2番目のものは機能が少なくなります。最初のものを制御します – vincentieo

答えて

0

(セミ実施例は、(何らかの理由で)のためにクロムではありません)。私はそれがIDを介してhtml要素を見つけるのは良い方法ではないことがわかります。 $('.class').each(function(i,obj){ /* do sth */})はビジネスに対応できます。

this postをチェックし、そこにサンプルがあります。

希望すると助かります。

関連する問題