0

I started my first backbone.js app today and I meet a first problem. I use RequireJS, Backbone and Underscore.

So I wrote this :

main.js

require.config({
  paths: {
    jquery: 'libs/jquery/jquery-min',
    underscore: 'libs/underscore/underscore-min',
    backbone: 'libs/backbone/backbone-optamd3-min',
    text: 'libs/require/text',
    jticker: 'libs/jquery/jquery.jticker'
  }

});

require([
  'app'
], function(App){
  App.initialize();
});

app.js

define([
  'jquery',
  'underscore',
  'backbone',
  'router', // Request router.js
], function($, _, Backbone, Router){
  var initialize = function(){
    Router.initialize();
  }

  return {
    initialize: initialize
  };
});

view app.js call by the default route

define([
  'jquery',
  'underscore', 
  'backbone',
  'jticker'
  ], function($, _, Backbone, jticker){
  var AppView = Backbone.View.extend({

    el: $("body"),

    initialize: function() {
      _.bindAll(this, 'render');
    },

    render: function() {
        $(this.el).append('bla');
        $(".dialogue").jticker();
    },

  });
  return AppView;
});

And i have this problem how can I use jticker in my view ? Actually it produce an error without details :

$(
[Stopper sur une erreur]    

$(".dialogue").jticker();
1
  • What does your template look like? Do you already have .dialogue dom elements on the page? Also, is jticker wrapped to define a module that can be included? Commented Jan 17, 2012 at 6:07

1 Answer 1

2

Have you try to use jticker() after the rendering? because i have the same problems actually in one of my project! If you wait that the DOM completly loaded and then set ".dialogue" with jticker()... just my 5 cents

Sign up to request clarification or add additional context in comments.

1 Comment

I fix it by adding order.js plugin and it looks like it works

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.