Question

I have a project with a very standard layout so I suspect this is a common problem:

<body>
HEADER-CONTAINER DIV - includes superfish jQuery menu plugin but am open to other menu options if necessary.
CONTENT-CONTAINER DIV - depending on the page, contains several other jQuery plugins, HTML, javaScript, etc.
FOOTER-CONTAINER DIV
</body>

I'm looking for a elegant and well performing way to have a superfish menu click load the CONTENT-CONTAINER DIV with new content. The content contains both HTML and javaScript. I also want the solution to change the URL so if someone returns later to /my/page it will reload to the correct location (similar my understanding of Backbone.Router).

Any suggestions? If possible, please provide a link to a page loading into a div example and running any javaScript included in the load.

Was it helpful?

Solution 2

I searched around and found the a decent example that shows how to take any #url and reload a div. Example found at http://thomasdavis.github.com/examples/restful-app/

OTHER TIPS

Superfish or not this is not really a problem. Whenever you add html to the page the browser will execute any javascript or load any javascript file this new html snippet will contain.

So when you click on your menu, you load (or generate) new html and replace your content div with this new content, the browser will execute the scripts.

You will have to rebind all events on that newly inserted content because jQuery will loose track of that.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top