CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   JavaScript programming (http://www.codingforums.com/forumdisplay.php?f=2)
-   -   How to recreate an instance/object - JS Timeline for example (http://www.codingforums.com/showthread.php?t=286484)

teddy4d 01-26-2013 03:55 PM

How to recreate an instance/object - JS Timeline for example
 
I'm working on my own web app which displays different things on the same page, depending on what you click. This is all controlled by javascript and Jquery filling the page divs.

I have a small problem, but I don't understand objects much so I'm confused...

Here, I create a js-timeline:

Code:

  var timeline = new VMM.Timeline();
  timeline.init("json-timeline-person.php?global_pernr=1234");

But I also want to re-run this code later on when you press that button again (for a different person)

Problem: When you re-click the button, the above code recreates the timeline BUT the existing instance of it exists, so I am actually creating multiple instances which causes the timeline to flicker.

I also have the same problem with some other items, not just timeline, so my question is really, how do I delete/clear the var timeline ?

I've not explained what the thing actually does, because this is a more general problem I have regarding how objects are created/re-created.


All times are GMT +1. The time now is 09:06 PM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.