2012-03-18 48 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> 
    ...