javascript - jquery ui 选项卡与 Jade

标签 javascript jquery jquery-ui node.js pug

您好,我正在尝试使用用于 Node js 的 jade 模板引擎创建 Jquery UI 选项卡。而且它不起作用。

这是 index.jade:

#tabs
  ul
    li
      a(href='#tabs-1') New employee
    li
      a(href='#tabs-2') Index of employees

  #tabs-1
    .page-header
      h1 New employee

    - var form = formFor(employee, {action: pathTo.employees(), method: 'POST', id: "employee_form", class: 'form-horizontal'})

    != form.begin()
    include _form
    .form-actions
      != form.submit('<i class="icon-ok icon-white"></i>  Create employee', {class: 'btn btn-primary'})
      span= ' or '
      != linkTo('Cancel', pathTo.employees(), {class: 'btn'})
    != form.end()

  #tabs-2
    .page-header
      h1 Index of employees


    - if (employees.length) {
    .row
      .span12
         table.table.table-striped
           thead
             tr
               th ID
               th.span3 Actions
           tbody
             - employees.forEach(function (employee) {
             tr
               td
                 != linkTo('employee #' + employee.id, path_to.employee(employee))
               td
                 != linkTo('<i class="icon-edit"></i> Edit', pathTo.edit_employee(employee), {class: 'btn btn-mini'}) + ' '
                 != linkTo('<i class="icon-remove icon-white"></i> Delete', pathTo.employee(employee), {class: 'btn btn-mini btn-danger', method: 'delete', remote: true, jsonp: '(function (u) {location.href = u;})'})
             - });
    - } else{
    .row
      .span12
         p.alert.alert-block.alert-info
            strong No employees were found.
    - }

这是我的layout.jade

!!! 5
html
  head
    title= title
    != stylesheetLinkTag('http://ajax.googleapis.com/ajax/libs/jqueryui/1.9.1/themes/base/jquery-ui.css', 'bootstrap', 'application', 'bootstrap-responsive')
    != javascriptIncludeTag('http://ajax.googleapis.com/ajax/libs/jqueryui/1.9.1/jquery-ui.js', 'https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js', 'rails', 'application')
    script
      $(document).ready(function() {
        alert("hi");
        $("#tabs").tabs();
      });
    != csrfMetaTag()
  body
    .navbar
        .navbar-inner
            .container
               a.brand(href='#') Project name

    .container
      - var flash = request.flash('info').pop(); if (flash) {
        .alert.alert-info= flash
      - }

      - flash = request.flash('error').pop(); if (flash) {
        .alert.alert-error= flash
      - }

      != body

      hr
      footer
        p © Company 2012
  != contentFor('javascripts')

选项卡未呈现。

呈现的 html 位于:http://jsfiddle.net/DUUdr/5/

但这在 jade 中不起作用

最佳答案

它起作用了,错误在 jquery-min.js 和 jquery-ui.js 的位置

在将 javascript 链接到页面时,Jquery-min.js 应该是第一个,Jquery-ui.js 是第二个

已更新

 != javascriptIncludeTag('http://ajax.googleapis.com/ajax/libs/jqueryui/1.9.1/jquery-ui.js', 'https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js', 'rails', 'application')

  != javascriptIncludeTag('https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js', 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.9.1/jquery-ui.js', 'rails', 'application')

关于javascript - jquery ui 选项卡与 Jade ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15224161/

相关文章:

javascript - 在 ng-bind-html 中渲染 Angular 代码

javascript - 从通过 jQuery AJAX 调用的 Controller 返回 PDF

jquery - 如何在打开新对话框之前关闭所有 jquery ui 对话框?

javascript - jQuery-UI - 多个自动完成字段共享结果

javascript - 使用 pjax 时将页面初始化 javascript 放在哪里?

jQuery - 替换标准单选按钮 click() 操作

Javascript/Jquery 结合 text+url var 用作数组

jQuery datepicker "dateFormat"和 "altFormat"之间的区别

javascript - jQuery UI 无法使用 GWT 正确加载

javascript - 如何使用 Django REST Framework 保存嵌套的 Backbone 模型