Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 同一页面上的href在Rails 4上不起作用_Ruby On Rails_Haml - Fatal编程技术网

Ruby on rails 同一页面上的href在Rails 4上不起作用

Ruby on rails 同一页面上的href在Rails 4上不起作用,ruby-on-rails,haml,Ruby On Rails,Haml,我想提供一个导航栏,上面有超链接,链接到同一页面的另一个部分 但它不起作用 当我点击导航栏上的服务链接时,浏览器中的url已从http://localhost:3000至http://localhost:3000/#.service 但是浏览器没有将窗口移动到服务区 这是我的导航条形码 %li %a{href: "#"} Home %li %a{href: "#.service"} Service 以下是页面的haml源代码 .service / S

我想提供一个导航栏,上面有超链接,链接到同一页面的另一个部分

但它不起作用

当我点击导航栏上的服务链接时,浏览器中的url已从
http://localhost:3000
http://localhost:3000/#.service

但是浏览器没有将窗口移动到服务区

这是我的导航条形码

    %li
      %a{href: "#"} Home
    %li
      %a{href: "#.service"} Service
以下是页面的
haml
源代码

.service
  / Start service
  .container
    %h2.head SERVICE
    %p.para Et harum quidem rerum et expedita distinctio.
    .service-top
      .row
        .col-md-3.col-sm-3
          / Service top item
          .text-center
            .simg
              / Images
              %img.simg-one.animated{alt: "", src: "img/service/12.png"}/
              %img.simg-two.animated{alt: "", src: "img/service/11.png"}/
            / Heading
            %h3 Mail Box
你应该仔细阅读


您需要链接到
锚定
,该锚定在HTML中定义为
名称
ID

%a{href: "#service"}

.service{ id: "service" }
当我研究这个答案时,我发现了,但实际上是
ID
(HTML5不支持
name
):


你能提供一个链接来讨论
%a名称的去润滑吗?答案是-w3
name
Not supported in HTML5. Use the id attribute instead. Specifies the name of an anchor