Adding Lightbox to wordpress

I need to add lightbox to a theme instead of using the plugin. I added it and everything works fine but for some reason close.png and loading.gif images keeps referring to site.com/images/close.png . My lightbox.js is in themes/mytheme/libs and images are in themes/mytheme/images . I have changed lightbox.js as following .

 this.fileLoadingImage = '../images/loading.gif';
  this.fileCloseImage = '../images/close.png';

Answers


If you are needing to include the full path in your lightbox.js file one way to do it is to follow this example -> Path to WordPress Template Directory inside jQuery?

You would set the value of a variable to the Wordpress template directory in your header.php prior to the inclusion of lightbox.js and then use that variable to produce an absolute path;

 <script type="text/javascript">
     var templateDir = "<?php bloginfo('template_directory') ?>";
 </script>

Need Your Help

Combining data from multiple tables based on the first table

mysql sql sql-server tsql

I have a table full of items, at the moment there is only one type and everything about that item is in the same table. Now I want to add two more types. A number of columns (>10) will be unique to...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.