Snap Shot widget for dynamic DOM nodes
I'm using Snap.com service to create snapshots to Wikipedia links on my web page. It works fine with the links in the page when pa开发者_运维百科ge is loaded. But it doesn't work when new links are created and inserted into the web page via Javascript.
The Snap.com script is called once when the page is loaded:
<html>
<body>
...
<script type="text/javascript" src="http://shots.snap.com/ss/my-id/snap_shots.js"></script>
</body>
</html>
Is there a way to reacivate their script after new DOM nodes are created in the document? Or some other way to solve this issue?
I've found the solution by inspecting Snap.com sources. The following code forces Snap.com to reprocess the page:
SNAP_COM.shot_main_js_called = false;
SNAP_COM.shot_main_js();
精彩评论