{"id":133,"date":"2014-07-03T03:22:36","date_gmt":"2014-07-03T03:22:36","guid":{"rendered":"http:\/\/html5box.com\/blog\/?p=133"},"modified":"2014-07-03T03:22:36","modified_gmt":"2014-07-03T03:22:36","slug":"open-lightbox-with-javascript-function","status":"publish","type":"post","link":"https:\/\/html5box.com\/blog\/jquery-lightbox\/open-lightbox-with-javascript-function\/","title":{"rendered":"Open Lightbox with JavaScript function"},"content":{"rendered":"<p><strong>Question<\/strong>:<\/p>\n<p>Is there a way to toggle the Lightbox on and off programmatic. For example, I would like to control how the Lightbox opens and closes. Do you guys have a developers guide to this. Let me know. Thank you.<\/p>\n<p>PS I know html5Lightbox.finish() will help close it. But what is the global function to open the lightbox?<\/p>\n<p><strong>Answer<\/strong>:<\/p>\n<p>You can call the JavaScript API to open the Lightbox, for example:<\/p>\n<p>Open image:<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\nhtml5Lightbox.showLightbox(0, 'images\/Toronto_1024.jpg', 'Image lightbox');\r\n<\/pre>\n<p>Open YouTube;<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\nhtml5Lightbox.showLightbox(3, 'http:\/\/www.youtube.com\/embed\/YE7VzlLtp-4', 'YouTube lightbox');\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Question: Is there a way to toggle the Lightbox on and off programmatic. For example, I would like to control how the Lightbox opens and closes. Do you guys have a developers guide to this. Let me know. Thank you. PS I know html5Lightbox.finish() will help close it. But what is the global function to &hellip; <a href=\"https:\/\/html5box.com\/blog\/jquery-lightbox\/open-lightbox-with-javascript-function\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Open Lightbox with JavaScript function<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[],"class_list":["post-133","post","type-post","status-publish","format-standard","hentry","category-jquery-lightbox"],"_links":{"self":[{"href":"https:\/\/html5box.com\/blog\/wp-json\/wp\/v2\/posts\/133","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/html5box.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/html5box.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/html5box.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/html5box.com\/blog\/wp-json\/wp\/v2\/comments?post=133"}],"version-history":[{"count":1,"href":"https:\/\/html5box.com\/blog\/wp-json\/wp\/v2\/posts\/133\/revisions"}],"predecessor-version":[{"id":134,"href":"https:\/\/html5box.com\/blog\/wp-json\/wp\/v2\/posts\/133\/revisions\/134"}],"wp:attachment":[{"href":"https:\/\/html5box.com\/blog\/wp-json\/wp\/v2\/media?parent=133"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/html5box.com\/blog\/wp-json\/wp\/v2\/categories?post=133"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/html5box.com\/blog\/wp-json\/wp\/v2\/tags?post=133"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}