2012-04-30 74 views
0

我有我想要滑動圖像問題的網頁是,當我雙擊按鈕它幻燈片和單擊它不滑動我不知道爲什麼這個正在發生。動畫工作雙擊不單擊

我的Java腳本滑動

 <script> 
      function class1(id, newclass){ 
       myid=document.getElementById(id); 
       myid.className=newclass; 
       } 
      </script> 

    <div id="page_three" class="panel"> 
    <div class="main_heading_three">DRAXXIN</div> 
    <div class="menu"> 
      <ul> 
        <li class="stix"></li> 
        <li><a href="#page_one"><img src="image/overview.gif" /></a></li> 
        <li class="stix"></li> 
        <li><a href="#page_two"><img src="image/strategy.gif"/></a></li> 
        <li class="stix"></li> 
        <li><a href="#page_three" onclick="class1('img_one_slide','img_one');class1('img_two_slide','img_two');"><img src="image/draxxin_active.png"/></a></li>       <li class="stix"></li> 
        <li><a href="#page_four"><img src="image/excede.gif"/></a></li> 
        <li class="stix"></li> 
        <li><a href="#page_five" onclick="class1('test','img_six_2');"><img src="image/results.gif"/></a></li> 
        <li class="stix"></li> 
        <li><a href="#"><img src="image/reference.gif"/></a> 
          <ul> 
          <li><a target='_blank' href="DRAXXIN-Product-Insert.pdf"><img src="image/dropdown1.png"/></a></li> 
          <li><a target='_blank' href="DRAXXIN-Product-Insert.pdf"><img src="image/dropdown2.png"/></a></li> 
          </ul> 
        </li> 
        <li class="stix"></li> 
       </ul> 
      </div> 
      <div class="rightclass_two"><img src="image/whiteslide.png"/></div> 
      <div> 
       <ul> 
        <li class="midmenu_3"><a href="#page_two"><img src="image/backward.png"/></a></li>  
        <li class="midmenu_4"><a href="#page_four"><img src="image/forward.png"/></a></li> 
       </ul> 
      </div>     
      <div class="text_paragraph_3"> 
       <p>DRAXXIN ® (<i>tulathromycin</i>) keeps working for up to 14 days.<span class="superscript">1, 2</span> 
       </p> 
      </div> 
      <div class="text_paragraph_4"> 
       A single dose of DRAXXIN ® (<i>tulathromycin</i>): 
       <ul><li>Controls and treats the four major BRD pathogens, including <i>Mycoplasma bovis</i></li> 
        <li>Decreases the total number of treatments</li> 
        <li>Reduces associated labor and treatment costs</li> 
       </ul> 

      </div> 
      <div class="text_paragraph_5"> 
       <p class="para">Pre-slaughter Withdrawal Time 18 days </p> 
       <p class="para_2">IMPORTANT SAFETY INFORMATION</p> 
       <p class="para_1">Do not use DRAXXIN in calves to be processed for veal. A pre-slaughter withdrawal time has not been determined for pre-ruminating calves. Effects on reproductive performance, pregnancy and lactation have not been determined. 
       </p> 
      </div> 
      <div class="right_text_page3"> 
      <p>With longer duration, DRAXXIN extends your PMIs or PTIs for a greater return on your investment. 
      </p> 
      </div> 
      <div class="right_text_page4"> 
      <p> 
      DRAXXIN has been shown to work with a 14-day PMI on high-risk cattle compared with other antimicrobials using a 3-day PMI<span class="superscript">7</span> 
      </p> 
      </div> 
      <div class="right_text_page5"> 
      <small> 
      <p> 
      a,b Different superscripts identify statistically different values (P=0.0005) through 208 days. 
      </p> 
      <p>*Least square means.</p> 
      </small> 
      </div> 
      <div class="right_text_page6"> 
      <p> 
      A study<span class="superscript">8</span> of DRAXXIN shows, even at 7-, 10- or 14-day 
      PTIs, extending the PTI resulted in no change to 
      treatment responses, or slight improvement 
      </p> 
      </p></div> 
      <div class="right_text_page7"> 
      <p> 
      At 7, 10 or 14 days, there were no differences in 
      mortality rate or ADG<span class="superscript">8</span> 
      </p> 
      <p> 
      (<small><i>P=0.34</i></small>) 
      </p> 
      </p> 
      </div> 

這些是滑動圖像。

 <div id="img_one_slide" class="img_one_in"><img src="image/graph_one.png"/></div>  
    <div id="img_two_slide" class="img_two_in"><img src="image/graph_two.png"/></div> 

<!--Draxxin page light box--> 
+0

你的頁面中沒有Javascript嗎? –

+0

需要查看您用於滑動的代碼。 – vdbuilder

+0

回答

1

您需要從元素的刪除HREF或移動的onclick到另一個元件。

實際上,a元素上的兩條「指令」(由onclick設計的指令和自然跳轉到href)是衝突的。

編輯:

這裏有一個方法(使用jQuery)做兩個頁面跳轉和滑動:

function doThing() { 
    $('html, body').animate({ 
     scrollTop: $('a[name="page_three"]').offset().top + 'px' 
    }, 'fast'); 
    class1('img_one_slide','img_one'); 
    class1('img_two_slide','img_two'); 
} 



<li><img style="cursor:pointer;" src=... onclick="doThing();"> 

我加光標:指針;讓用戶知道圖像是可點擊的。

+0

滑動你能解釋我更多或編輯mycode的請 – user1365106

+0

我需要知道你試圖做什麼。你爲什麼有這個href?您是否希望頁面中的位置發生變化並且圖像滑動? –

+0

我希望當我點擊Draxin按鈕打開頁面,並在該頁面上滑動圖像的時候,這就是爲什麼如果只給頁面的href然後在哪裏給滑動的onclick – user1365106