麻烦jquery lavalamp

出于某种原因,无论我点击什么链接,我的背景颜色都会回到最左边的链接。 任何人都知道如何让它留在点击链接?

CSS

#lamp { float:left; margin:25px 0px 0px 90px; clear: both; } .lavaLamp { position: relative; height: 29px; width: 400px; background: #000000 no-repeat top; background-image:url('http://sofzh.miximages.com/jquery/lampback.png'); padding: 15px; margin: 10px 0; overflow: hidden; float:left; } /* Force the list to flow horizontally */ .lavaLamp li { float: left; list-style: none; } /* Represents the background of the highlighted menu-item. */ .lavaLamp li.back { background: no-repeat right -30px; width: 9px; height: 30px; z-index: 8; position: absolute; } .lavaLamp li.back .left { background: #BD5108 no-repeat top left; height: 30px; margin-right: 9px; } /* Styles for each menu-item. */ .lavaLamp li a { position: relative; overflow: hidden; text-decoration: none; text-transform: uppercase; font: bold 14px arial; color: #fff; outline: none; text-align: center; height: 30px; top: 7px; z-index: 10; letter-spacing: 0; float: left; display: block; margin: auto 10px; } 

jQuery的

  $(function() { $(".lavaLamp").lavaLamp({ fx: "backout", speed: 700 })});  

网站http://wildfire-restaurant.com/

您需要将类current添加到子页面上的当前li 。 lavalamp插件运行这段代码:

 curr = $("li.current", this)[0] || $($li[0]).addClass("current")[0]; 

选择带有current类或第一项的li 。 您可以在发送到客户端之前在服务器上添加此类,而无需在javascript中执行此操作。

更新

当您的浏览器位于“/ menu /”页面时,这就是HTML的导航效果。 注意带有Menu链接的li如何具有class="current"

  

EVENTS页面上,带有“ Events ”链接的li将具有以下类:

 
  • Events
  • 等等

    如果你使用这个扩展….

    尝试将’autoreturn’设置为true。

    否则可能有一个选项来设置背景返回的链接。 在这种情况下,您必须将其设置为onClick()。

    尝试阅读文档。

    此外,发布有关您使用的扩展名的更多信息将是有益的。 这不是CSS问题。