Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/40.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
Node.js 将Jquery UI与express.js一起使用_Node.js_Jquery Ui_Backbone.js_Express_Pug - Fatal编程技术网

Node.js 将Jquery UI与express.js一起使用

Node.js 将Jquery UI与express.js一起使用,node.js,jquery-ui,backbone.js,express,pug,Node.js,Jquery Ui,Backbone.js,Express,Pug,我正在使用一个节点主干应用程序。我创建动态内容,并将jquery UI Dragable添加到我创建的内容或元素中。但是,当我的模板系统呈现时,我的元素甚至不会移动。路径是正确的。我使用一个类来引用这些元素和draggable方法 有人能告诉我什么是包含jquery ui和jquery脚本以便正确加载的正确方法吗 布局jade-index.jade-模板扩展index.jade中呈现的布局 block content block scripts extends layout blo

我正在使用一个节点主干应用程序。我创建动态内容,并将jquery UI Dragable添加到我创建的内容或元素中。但是,当我的模板系统呈现时,我的元素甚至不会移动。路径是正确的。我使用一个类来引用这些元素和draggable方法

有人能告诉我什么是包含jquery ui和jquery脚本以便正确加载的正确方法吗

布局jade-index.jade-模板扩展index.jade中呈现的布局

  block content
  block scripts


extends layout

block content
  div#content

block scripts
  script(data-main='js/boot', type='text/javascript',src='/js/libs/require.js')
  script(type='text/javascript', src='http://code.jquery.com/ui/1.10.3/jquery-ui.js')
在我的应用程序中,我有一个连接到主干网的jquery模块,但由于某些原因,jquery UI没有连接到它,因此我必须在它旁边添加一个jquery脚本。但是,当我在模板中创建带有主干的动态元素时,jquery将不起作用。我使用.html将它们添加到模板中

这是杰德先生

!!! 5
html(lang="en")
  head
    title project
    meta(name='viewport', content='width=device-width, initial-scale=1.0')
    link(rel='stylesheet',href='/styles/bootstrap.css')
    link(rel='stylesheet',href='/styles/styles.css')

  body
   .navbar.navbar-inverse
    .container
        button.navbar-toggle(type='button', data-toggle='collapse', data-target='.nav-collapse')
          span.icon-bar
          span.icon-bar
          span.icon-bar
        a.navbar-brand(href='#') 
         img(src='/img/greatlogowhite.png', width='300')
        .nav-collapse.collapse
          ul.nav.navbar-nav
            li.active
             a(href='#') 
              img(src='/img/house.svg', width='70')
            li
             a(href='#about')
              img(src='/img/pen.svg', width='70')
            li
             a(href='#contact')
              img(src='/img/search.svg', width='70')
            li
             a(href='#contact')
              img(src='/img/chat.svg', width='70')
我是杰德

  block content
  block scripts


extends layout

block content
  div#content

block scripts
  script(data-main='js/boot', type='text/javascript',src='/js/libs/require.js')
  script(type='text/javascript', src='http://code.jquery.com/ui/1.10.3/jquery-ui.js')
这就是我尝试使用jQueryUI的方式

<script> 
    $(document).ready(function() {
           $( ".pic" ).draggable();
    });
</script> 

事实上,我这样做是为了解决这个问题。无论谁使用主干、node.js和require.js,请记住将jquery和jquery UI作为库包含在require中,以及在使用主干创建动态元素时,例如:

$('#content').append(html); inside backbone call jquery UI

            $('.drag').draggable();

向我们展示您是如何加载jquery的,以及jquery UIS是如何向我们展示您的尝试的。