2012-03-18 49 views
0

我有一個關於magento模板的問題,我正在嘗試構建。magento jQuery用戶界面按鈕

我創建了一個基本的Magento模板的基礎上,Yoast_Blank_Seo_Theme,示範商店是http://shop.x11.us

在Chrome,所有的頂級環節的工作,其中作爲火狐他們沒有做任何事情。添加到購物車按鈕也沒有。

如果您在Firefox上將商店更改爲_store = en「> http://shop.x11.us/index.php/?_store=en,則鏈接正常工作(這會切換回默認模板)

如果我刪除從我local.xml中的以下內容:

 <block type="core/text" name="buttons.jquery"> 
      <action method="setText"> 
       <text><![CDATA[<script type="text/javascript"> 
        $j(function() { 
         $j(".button").button(); 
        }); 
        </script>]]> 
       </text> 
      </action> 
     </block> 

鏈接做工精細,但後來我沒有得到按鈕的效果我如何正確地包括了jQuery按鈕,讓他們在工作正確嗎?

任何意見非常讚賞

+1

我不明白你的apparoach。爲什麼在'local.xml'中使用javascript代碼塊?你可以把這些函數放在一個javascript文件中,而不是通過local.xml文件鏈接'addJS'。對你來說不是那麼容易? – 2012-03-18 11:28:51

+0

這將呈現文本內聯(假設父級呈現它)。好處(?):減少一個http請求,不需要額外的模板文件。 – benmarks 2012-03-18 22:17:03

+0

任何想法爲什麼這不適用於Firefox? – khinester 2012-03-19 09:54:07

回答

0

嘗試驗證您的網頁http://validator.w3.org/並解決錯誤。 這個問題似乎與您的html代碼:

<ul class="links"> 
    <button type="label" title="My Account" class="button ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" role="button" aria-disabled="false"> 
     <li class="first" > 
      <span class="ui-button-text"><a rel="nofollow" href="http://shop.x11.us/index.php/customer/account/" title="My Account" >My Account</a></span> 
     </li> 
    </button> 
    ... 

我不認爲它是有效的有按鈕元素中的錨標記。 <button>元素直接在<ul>元素下也是無效的。嘗試重構你的HTML這樣的:

<ul class="links"> 
    <li class="first" > 
     <a rel="nofollow" href="http://shop.x11.us/index.php/customer/account/" title="My Account" > 
      <button type="label" title="My Account" class="button ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" role="button" aria-disabled="false"> 
       <span class="ui-button-text">My Account</span> 
      </button> 
     </a> 
    </li> 
    ...