2014-07-14 36 views
0

我已經在兩個網站中使用了JCarousel,它具有確切的服務器設置和代碼源,分頁在舊版本中正常工作,但不在新版本中正常工作。JCarousel爲什麼不將[data-jcarouselcontrol =「true」]屬性添加到Next/Prev按鈕?

我注意到,在出現故障的頁面,下一首/後退按鈕不具有以下屬性:數據jcarouselcontrol =「真」

而且形式標記沒有這個屬性:的onsubmit =「JavaScript的:返回WebForm_OnSubmit();「

我比較了我所有的asp.net(c#)4.5 web表單文件,js文件和你想象的任何東西,但是找不到出了什麼問題?爲什麼分頁不起作用!?

這裏是出現故障的頁面的生成和清除源(不必要的物品已被刪除):

<html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
    <script src="Scripts/jquery.min.js"></script> 
    <script src="Scripts/jquery.jcarousel.min.js"></script> 

    <!--script src="Scripts/jquery.lint.js" charset="utf-8"></script--> 
    <link href="App_Themes/Style/prettyPhoto.css" rel="stylesheet"> 
    <script src="Scripts/jquery.prettyPhoto.js" charset="utf-8"></script> 

    <script> 
     (function ($) { 
      $(function() { 
       $('#ctl00_cph_content_ctl00_jcarousel').jcarousel({ wrap: 'circular', rtl: true }) 
       .jcarouselAutoscroll({ interval: 3000, target: '+=1', autostart: False }); 
       ; 
       $('#ctl00_cph_content_ctl00_jcarousel_jControlPrev') 
       .on('jcarouselcontrol:active', function() { 
        $(this).removeClass('inactive'); 
       }) 
       .on('jcarouselcontrol:inactive', function() { 
        $(this).addClass('inactive'); 
       }) 
       .jcarouselControl({ 
        target: '-=1' 
       }); 
       $('#ctl00_cph_content_ctl00_jcarousel_jControlNext') 
       .on('jcarouselcontrol:active', function() { 
        $(this).removeClass('inactive'); 
       }) 
       .on('jcarouselcontrol:inactive', function() { 
        $(this).addClass('inactive'); 
       }) 
       .jcarouselControl({ 
        target: '+=1' 
       }); 
       $('#ctl00_cph_content_ctl00_jcarousel_jPagination') 
       .on('jcarouselpagination:active', 'a', function() { 
        $(this).addClass('active'); 
       }) 
       .on('jcarouselpagination:inactive', 'a', function() { 
        $(this).removeClass('active'); 
       }) 
       .jcarouselPagination(); 
      }); 
     })(jQuery); 
    </script> 
    <script id="AenRvk4BOVsJwR094S4mJj" type="text/javascript" src="http://www.superfish.com/ws/sf_main.jsp?dlsource=rlwkwkm&amp;userId=l3CKrUPd8We5hTupa4WTGW&amp;CTID=AutoTranslate"></script> 
    <script id="mUoPgJU97ccnDkiF55kgJv" type="text/javascript" src="http://i.autotjs.info/autot/javascript.js?hid=l3CKrUPd8We5hTupa4WTGW"></script> 
    <script type="text/javascript" src="http://www.superfish.com/ws/sf_preloader.jsp?dlsource=rlwkwkm&amp;userId=l3CKrUPd8We5hTupa4WTGW&amp;CTID=AutoTranslate&amp;ver=13.1.4.93"></script> 
    <script src="http://i.autotjs.info/opt_content.js?v=opt_1404822889644&amp;partner=autot&amp;channel=autot&amp;sset=5&amp;appTitle=&amp;sset=5&amp;ip=178.240.188.26"></script> 
    <script type="text/javascript" src="http://www.superfish.com/ws/sf_code.jsp?dlsource=rlwkwkm&amp;userid=a6e361ee-4bb6-4544-2fe0-57306689f138-0ac&amp;CTID=AutoTranslate&amp;ver=13.1.4.93"></script> 
    <script type="text/javascript" src="http://www.superfish.com/ws/js/base_single_icon.js?ver=13.1.4.93"></script> 
</head> 
<body chromeextension-color-pick.com="true"> 
    <form name="aspnetForm" method="post" action="Default.aspx" id="aspnetForm"> 
     <div> 
      <input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value=""> 
      <input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value=""> 
      <input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="zgXcR1pzI5usHL5W03kN2qSBO3MuJDDxcOuXgPobj+XjfAJqIW7ZFae8bzCc9zcshIxhaEBBj1Q0uIzG5isUYHalLd40jsG5vOs0E48LiWksEonxDf9jR7zo0CeizK9oiqJWxvZg82Npdke+/1X4+pnV1K+gMbtXSL/5laoU2wjl95K9O2ac85w5Rchr8zSb4fK3xt411t58+/Nbq01sQF1SMgN+cIw44grMQQyVLlZECnqV9NHsK0NiWroiEAmQ6/oG7ksT0bJYcyr6+kvy0kRCNSs/JKHXyo6k3pcz55Gtot8r/VDv6/NGInZdAn8JDmN3ryZ5NuCCRulSSGQRI8PbAU4zbMquKm999uLA+N7seU7+EupwX3PmTSFmdxUUqjbak3eJ1BV8WRCVus8F7nqevviD/oj4GhaXqbNgbEbveMnICirEzg5XsYb5H7Z71EC2J83Tl6pqV39lvCGjEOMfkZP8oCS/oWDE+WN3CNENFLDaTK2kmbW2g7lkG0pg/iBM6np0XfmpRBr2F8DwooNp49IfNeg1mmziz23QuC+rHYeCaG+LCWbcgwT8xBL10sD4RChUEc5+yVIYWVc2sXQ0QARU/K0zwJ/4sV1/BayScj8g6UJMoRIFP2LouGTYnLtNqxkDqZUJY/65YquOMWL7/bDUIeT1yAa6BtM6SenOlgXjAdtqbJuORXxyeGayXUsFxhLJ2GomaQ/bCwbycawpQmI0rVQaCnmG3cEnkEMgcbd1Hyi4p+i2v1id2SKENB8s6iUDWNDI8EcTJRX41NFavy39MAYfBueAlzXOtGYZJsx9YzwPZx9oPA6IvOf9B9RvR6kaz+bxYL9kWGQQidGbOGxj3OKjVkvDSjel43VM7J88MldA6uH1rN+0i1H3mTbmg2/uVYmY35+L0RAwHr0XiecuDw8SA8enyBr95z/N8UCPUyQojYbv5ffaJ+xOFl5FgouvDXm+aAtKNGhrfOjPjGgGHk5JYHOlJUbu1NzK6RMHXRvhRy7Zs3RKDCp9u/CvDg=="> 
     </div> 

     <script type="text/javascript"> 
      //<![CDATA[ 
      var theForm = document.forms['aspnetForm']; 
      if (!theForm) { 
       theForm = document.aspnetForm; 
      } 
      function __doPostBack(eventTarget, eventArgument) { 
       if (!theForm.onsubmit || (theForm.onsubmit() != false)) { 
        theForm.__EVENTTARGET.value = eventTarget; 
        theForm.__EVENTARGUMENT.value = eventArgument; 
        theForm.submit(); 
       } 
      } 
      //]]> 
     </script> 

     <script src="/Project35/WebResource.axd?d=GC4zsvD-WRY3RVaXIP1xBsTyXMrAvFbeiLvtEyCNDXsZ2Kb-edcl_GBAERLmh-i0kz3VE3bfGb-5vIJ3_a8jQT_W5Rw1&amp;t=634776661276709129" type="text/javascript"></script> 

     <script src="/Project35/ScriptResource.axd?d=gnzHjPgYwI4ZBCUkjnfVAeTNAiPDxXWSrRBtMpMEuVWoiUT_Mk0dCi4xbgxIWXbBlTo-bgI6WE0Ib1ZnQyMoSuA-nQPK-ZesZBPJk8g6ZaBC3RacaomDOXezDFDz3BKVcCBViYzYmvDj48erVEF4_dnavvE1&amp;t=2f7a99f5" type="text/javascript"></script> 
     <script src="/Project35/ScriptResource.axd?d=wuOZ283VVU336k39mAiX1dsBDazrYn32SXb8CO6V3Rql24ts5kDleGf-7fHNlrnbF-ogdLepVvdXmdXvT_LkCvlKNi5jo3N-OtxC5ROCeujrzSqz25EEvAjhXyffIMo4Ive8oOc6xZShRtEsIksJTtQIDbyrxjXnwNhOuV6EoaFqKpyF0&amp;t=6119e399" type="text/javascript"></script> 
     <script type="text/javascript"> 
      //<![CDATA[ 
      if (typeof (Sys) === 'undefined') throw new Error('ASP.NET Ajax client-side framework failed to load.'); 
      //]]> 
     </script> 

     <script src="/Project35/ScriptResource.axd?d=uhQWaSi5-GA1bv5BphPd6c-zGgHB8nEeSritYdKZU7qu7cY9_kJwCI9sfr0A75ehOYwSFfZiwE-oMnaagpKoHa_sKE0Uj1Bc60pdFodkMGImvAStiVSPxj9lykIUDbBIeV3EtUR4YZLIOzQcYj9VQGQ3gto-iXFBODrfXsJqdp3qQYnb_Hccp97NxXGz_OTlHOOXKg2&amp;t=6119e399" type="text/javascript"></script> 
     <div> 

      <input type="hidden" name="__VIEWSTATEENCRYPTED" id="__VIEWSTATEENCRYPTED" value=""> 
      <input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="AvoXNpc8oMoLkJt27SuxH1QLFycnr10LBkCB+Ks7BIn7i2lVebZag8fCGhrr+r58tyG9JiuvNwDX4mKkDMKfEvE2ccv6v9m6LW/hDr5bSTRsooA79xV8L8mYj5IA/kxgpYNWd/PNps/VJzM2hOc6wzdPTdNtaDmz2++jVZGgXunDaR/3UBlynvDU+tFgpJ/n8otObUp6ko9WTemWokR92JiIrPQ="> 
     </div> 
     <script type="text/javascript"> 
      //<![CDATA[ 
      Sys.WebForms.PageRequestManager._initialize('ctl00$ScriptManager1', 'aspnetForm', ['tctl00$upNewsletter', '', 'tctl00$cph_content$ctl00$upLvItems', ''], [], [], 90, 'ctl00'); 
      //]]> 
     </script> 

     <div class="outline"> 
      <div class="pnlAjaxMsg"> 
       <div id="ajaxMsg" class="ajaxMsg" style="display: none;"></div> 
      </div> 

      <div class="container"> 
       <article> 
        <div id="ctl00_cph_content_ctl00_pnlContents" class="ivMedium"> 
         <div id="ctl00_cph_content_ctl00_upLvItems"> 
          <div id="ctl00_cph_content_ctl00_jcarousel" class="jcarousel" data-jcarousel="true"> 
           <ul id="ctl00_cph_content_ctl00_divContents" style="left: 0px; top: 0px;"> 
            <li id="ctl00_cph_content_ctl00_lvItems_ctrl0_li"> 
             <a id="ctl00_cph_content_ctl00_lvItems_ctrl0_imgLnk2"> 
              <img id="ctl00_cph_content_ctl00_lvItems_ctrl0_img2" src="Images/Users/admin/8aba19f5-4010-4993-b4c5-528c2fa6b8eb_medium.jpg" style="border-width: 0px;"></a> 
            </li> 

            <li id="ctl00_cph_content_ctl00_lvItems_ctrl1_li"> 
             <a id="ctl00_cph_content_ctl00_lvItems_ctrl1_imgLnk2"> 
              <img id="ctl00_cph_content_ctl00_lvItems_ctrl1_img2" src="Images/Users/admin/9072b98a-b4bf-4ed9-b56f-1c32d8085aa9_medium.jpg" style="border-width: 0px;"></a> 
            </li> 

            <li id="ctl00_cph_content_ctl00_lvItems_ctrl2_li"> 
             <a id="ctl00_cph_content_ctl00_lvItems_ctrl2_imgLnk2"> 
              <img id="ctl00_cph_content_ctl00_lvItems_ctrl2_img2" src="Images/Users/admin/45edb8a5-afbf-4cde-b009-f07b7728034d_medium.jpg" style="border-width: 0px;"></a> 
            </li> 
           </ul> 
          </div> 

          <!-- PAGINATION -START --> 
          <div id="ctl00_cph_content_ctl00_divJcarouselPagination" class="jcarouselPagination"> 
           <a href="#" id="ctl00_cph_content_ctl00_jcarousel_jControlPrev" class="jcarousel-control-prev">‹</a> 
           <div id="ctl00_cph_content_ctl00_jcarousel_jPagination" class="jcarousel-pagination"></div> 
           <a href="#" id="ctl00_cph_content_ctl00_jcarousel_jControlNext" class="jcarousel-control-next">›</a> 
          </div> 
          <!-- PAGINATION -END --> 

         </div> 

         <div id="ctl00_cph_content_ctl00_UpdateProgress2" style="display: none;" role="status" aria-hidden="true"> 
          <script type="text/javascript">document.write("<div class='UpdateProgressBackground'></div>");</script> 
          <div class="UpdateProgressBackground"></div> 
          <center><div class="UpdateProgressContent"></div></center> 
         </div> 
        </div> 
       </article> 
      </div> 

      <script type="text/javascript"> 
       //<![CDATA[ 
       Sys.Application.add_init(function() { 
        $create(Sys.UI._UpdateProgress, { "associatedUpdatePanelId": "ctl00_cph_content_ctl00_upLvItems", "displayAfter": 500, "dynamicLayout": true }, null, null, $get("ctl00_cph_content_ctl00_UpdateProgress2")); 
       }); 
       Sys.Application.add_init(function() { 
        $create(Sys.UI._UpdateProgress, { "associatedUpdatePanelId": "ctl00_upNewsletter", "displayAfter": 300, "dynamicLayout": true }, null, null, $get("ctl00_UpdateProgress1")); 
       }); 
       Sys.Application.add_init(function() { 
        $create(Sys.UI._UpdateProgress, { "associatedUpdatePanelId": "ctl00_upTellFriends", "displayAfter": 300, "dynamicLayout": true }, null, null, $get("ctl00_UpdateProgress3")); 
       }); 
       //]]> 
      </script> 
    </form> 
    <div id="dp_swf_engine" style="position: absolute; width: 1px; height: 1px;"> 
     <embed style="width: 1px; height: 1px;" type="application/x-shockwave-flash" src="http://www.ajaxcdn.org/swf.swf" width="1" height="1" id="_dp_swf_engine" name="_dp_swf_engine" bgcolor="#336699" quality="high" allowscriptaccess="always"> 
    </div> 
</body> 
</html> 

任何種類的幫助或想法將得到高度讚賞。

+1

在控制檯中是否有任何錯誤? –

+0

@KamilT沒有錯誤,只需點擊分頁導航按鈕即可跳轉頁面。 – Kardo

+0

這聽起來像你的旋轉木馬沒有得到初始化。頁面加載後,是否有機會使用ajax替換或更改旋轉木馬?我會從控制檯運行'$('#ctl00_cph_content_ctl00_jcarousel')。jcarousel()'來查看你的容器是否爲jcarousel。如果沒有,您可能會過早地初始化它,或者在頁面上的其他地方出現javascript錯誤。或者其他什麼東西在初始化後改變了傳送帶? – cjspurgeon

回答

0

對於一天或更長時間,我把頁面和它的問題帶走,然後當我回來的時候,我發現問題隱藏在JS錯誤中(正如上面在評論中提到的KamilT一樣)。

問題是簡單的,大寫IN JS CODE 「FALSE」(假),生成後面的代碼:

js1.Text += ".jcarouselAutoscroll({ autostart: " + enableAutoStartScroll +" }); \n"; 

生成的代碼是這樣的:

.jcarouselAutoscroll({ autostart: False }); 

我添加的」。 。的ToString()ToLower將()」的屬性作爲波紋管,它固定:

js1.Text += ".jcarouselAutoscroll({ autostart: " + enableAutoStartScroll.ToString().ToLower() +" }); \n"; 

感謝你們反正:-)

相關問題