jQuery菜单栏 - 外部链接不起作用

时间:2015-06-04 22:07:52

标签: jquery menubar

我有一个jQuery菜单栏,但外部链接有问题。我一直收到错误:

  

语法错误,无法识别的表达式:http://google.com

有什么想法吗?

这是我的代码:

import Html             exposing (..)
import Html.Attributes  exposing (..)
import Html.Extra       exposing (..)
import Signal

import Model.PickList   exposing (pickList)
import Model.BabyName.Debug as Debug

headerPane : Html
headerPane =
  header [ id "header" ]
  [ text "header" ]

leftPane : Signal Html
leftPane = flip Signal.map (.signal pickList) <| \pl ->
  ul []
  [ li []
    [ fromElement << show <| pl ] ]

mainPane : Html
mainPane =
  section [ id "main" ]
  [ text "what? what?" ]

layout : Signal Html
layout = flip Signal.map leftPane <| \lp ->

  div [ id "wrapper" ] <|
  [ headerPane
  , lp
  , mainPane ]

port toPicklist = Signal.send (.address pickList) Debug.dummyList

main : Signal Html
main = layout

和js:

<ul id="menu">
    <li><a href="#home">HOME</a></li>
    <li><a href="#about-us">ABOUT US</a></li>
    <li><a href="http://www.google.com" class="external">EXTERNAL</a></li>
    <li><a href="#contact">CONTACT</a></li>
</ul>

1 个答案:

答案 0 :(得分:2)

错误位于第var item = $($(this).attr("href"))行,这意味着var item = $(http://www.google.com),这是一个糟糕的选择器。