Links do not work after translation into slim format

梦想与她 提交于 2019-12-25 00:00:09

问题


I have an html code with rails. I need to translate it into slim format, I changed the file format, translated it with a convector and tried to run it as a result the links do not work, can you tell me why?

head.html.erb

<section id="header">
  <div class='navigation-panel'>
    <button class='burger-button' id='header-burger-button container'  onclick='burgerAction()'>
      <%= image_tag("header/burger.png") %>
    </button>
    <button class='contact-us-button burger-hidable container' onclick='scroller("contact")'> CONTACT US </button>
    <div class='menu-container burger-hidable container' style='display: none;'>
      <%= image_tag("header/menu.png") %>
    </div>
    <div class='nav-links burger-hidable' style='display: none;'>
      <p onclick='scroller("header")'>Home</p>
      <p onclick='scroller("services")'>Services</p>
      <p onclick='scroller("how-we-work")'>How We Work</p>
      <p onclick='scroller("team")'>Team</p>
      <p onclick='scroller("why-us")'>Why Us</p>
      <p onclick='scroller("portfolio")'>Portfolio</p>
      <p onclick='scroller("contact")'>Contact Us</p>
    </div>
  </div>
</section>

head.html.slim

section#header
  .navigation-panel
    button.burger-button id=("header-burger-button container") onclick="burgerAction()" 
      = image_tag("header/burger.png")
    button.contact-us-button.burger-hidable.container onclick="scroller(\"contact\")"  CONTACT US
    .menu-container.burger-hidable.container style=("display: none;") 
      = image_tag("header/menu.png")
    .nav-links.burger-hidable style=("display: none;") 
      p onclick="scroller(\"header\")"  Home
      p onclick="scroller(\"services\")"  Services
      p onclick="scroller(\"how-we-work\")"  How We Work
      p onclick="scroller(\"team\")"  Team
      p onclick="scroller(\"why-us\")"  Why Us
      p onclick="scroller(\"portfolio\")"  Portfolio
      p onclick="scroller(\"contact\")"  Contact Us

回答1:


I believe the problem is the escaped quotation inside the onclick attributes.

Consider using single quotes inside your attributes' double quotes: onclick="scroller('header')".

You can read more about escaping and quoting attributes here: https://www.rubydoc.info/gems/slim/frames#Output_without_HTML_escaping___



来源:https://stackoverflow.com/questions/52438274/links-do-not-work-after-translation-into-slim-format

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!