Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8738223
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T10:41:33+00:00 2026-06-13T10:41:33+00:00

I am using backbone.js to create a single page app. I am new to

  • 0

I am using backbone.js to create a single page app. I am new to backbone, so please forgive any wrong semantics.

My Problem is when rendering the views.

Initially, I have a javascript in my index.html that executes the some dom manipulation(image slider).

The JS is wrapped in $(window).load() so all is fine on initiation.
The code obviously doesn’t execute unless the page is loaded from url. the code will not run from backbone views or router. So the page loads without the dom manipulation.

I have tried to insert my code into the render and initialize function in the view, but to no avail. Should I add this code to the router? that seems to be a bit of a hack.

Where should I include the “dom ready” code?
and / or is there a better way to manage views and their dom elements on load in backbone?

the code:

home.js

window.HomeView = Backbone.View.extend({
initialize:function () {
    this.render();
},

render:function () {
    $(this.el).html(this.template());

    this.startOrbits();
    return this;
},



startOrbits:function(){
    $(window).load(function() {
        $('#orbit-main').orbit({ fluid: '16x6', swipe:true });
        $('#orbit-news').orbit({ fluid: '8x6', bullets: true, directionalNav:false, captions:true, advanceSpeed: 9000});
    });
},




});
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T10:41:34+00:00Added an answer on June 13, 2026 at 10:41 am

    I was able to find a solution.
    After commenting out the if statement in my router function, things went smoothly.

     home: function () {
                // if (!this.homeView) {
                    this.homeView = new HomeView();
                // }
                $('#main-content').html(this.homeView.el);
                this.homeView.startOrbits();
                this.headerView.selectMenuItem('home');
            },
    

    I do realize that this means I create a new view on every rout trigger.
    Please feel free to offer more optimal solutions.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am very new at using Backbone. Please forgive me in advance as I
I'm using jquery mobile and backbone.js to create a single page mobile application. The
I am working on a single-page app using Backbone.js. An issue that has occurred
I am using backbone and trying to create a new object and I am
I'm using WCF to create the REST backend for an app using backbone. WCF
I'm building a single page, offline html5 web application using jquery mobile, backbone, underscore
Using Backbone.JS, I am able to successfully create new models and save them to
I am using Backbone.js to create compound form fields which hold a telephone number
I'm building one page application using Backbone's router to modify browser history. I don't
I'm trying to keep track of the state in this app using Backbone.js: I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.