In my app I have a list of products and when you click on a product, a Fancybox opens to show the product details.
开发者_JAVA技巧Now when the user closes the Fancybox, I change the URL back from '#/product-name' to '#' and the list of products is rendered again, even though it is already there.
My question is:
How do I avoid the product list from being rendered again?
So somewhere either in the list action of my controller or the list view I want to check if the product list is already rendered and don't render it again.
It feels like something that should be possible to accomplish quite easily but I can't get it right.
All ideas appreciated!
EDIT: edited for clarification
Have a look at backbone:s saveLocation method. It doesn't trigger a hashchange event.
You only need to change the hash part of your url.
window.location.hash = ""
精彩评论