javascript - Button - updating graphics - throwing SyntaxError -
the pdb structure loads fine, when use button update image, not work. making "uncaught syntaxerror: unexpected token }"
really don't understand why that, button should call method 3dmol.js , redraw. simplified example since there multiple buttons change style , add remove labels.
original example here: https://github.com/3dmol/3dmol.js/blob/master/tests/example.html
<!doctype html> <html> <head> <title>3dmol example - changing render options</title> <link href="library/bootstrap-3.3.7-dist/css/bootstrap.min.css" rel="stylesheet"> <meta name="viewport" content="width=device-width, initial-scale=1" /> <link type="text/css" rel="stylesheet" href="style.css"> <!-- load online api; defer scripts execute after html has been parsed --> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script src="library/bootstrap-3.3.7-dist/js/bootstrap.min.js"></script> <script defer src="http://3dmol.csb.pitt.edu/build/3dmol-min.js" ></script> </head> <body> <!-- container whole page --> <div class='container'> <!-- row pdb , plot --> <div class='row'> <div class="col-md-12" > <div id='viewer3' class='viewer_3dmoljs' style="width: 600px; height: 600px; float:left;" data-pdb='3sn6' data-backgroundcolor='0xffffff' data-style='{"cartoon":{}}'> </div> </div> </div> <!-- row buttons --> <div class="row"> <div class="col-md-8"> <div id="gldiv" style="width: 600px; height: 600px; margin: 0; padding: 0; border: 0;"></div> <div class="col-md-4"> <hr style="margin: 0;"> <input type="button" value="stick" onclick="$3dmol.viewers["viewer3"].setstyle({},{stick:{}}); $3dmol.viewers["viewer3"].render();"></input> <input type="button" value="label alpha c's" onclick=addlabels($3dmol.viewers["viewer3"]); $3dmol.viewers["viewer3"].render();"></input> <input type="button" value="remove labels" onclick="$3dmol.viewers["viewer3"].removealllabels(); $3dmol.viewers["viewer3"].render();"></input> </div> </div> </div> </div> </div> </body> </html>
Comments
Post a Comment