<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">

 <title>Dave Dash</title>
 <link href="http://davedash.com/tag/lightbox/atom.xml" rel="self"/>
 <link href="http://davedash.com/tag/lightbox"/>
 <updated>2012-04-07T22:42:44-07:00</updated>
 <id>http://davedash.com/</id>
 <author>
   <name>Dave Dash</name>
   <email>dd+atom1@davedash.com</email>
 </author>

 
 <entry>
   <title>How to make Prototype Window Class as easy as Lightbox Gone Wild</title>
   <link href="http://davedash.com/2006/11/13/how-to-make-prototype-window-class-as-easy-as-lightbox-gone-wild/"/>
   <updated>2006-11-13T00:00:00-08:00</updated>
   <id>http://davedash.com/2006/11/13/how-to-make-prototype-window-class-as-easy-as-lightbox-gone-wild</id>
   <content type="html">&lt;p&gt;I like the way that &lt;a href=&quot;http://particletree.com/features/lightbox-gone-wild/&quot; title=&quot;Lightbox Gone Wild&quot;&gt;Lightbox Gone Wild&lt;/a&gt; will automatically pickup any links with the &lt;code&gt;class=lbOn&lt;/code&gt;, but I wanted to use (at some point) &lt;a href=&quot;http://prototype-window.xilinus.com/&quot; title=&quot;Prototype Window Class&quot;&gt;Prototype Window Class&lt;/a&gt; instead.&lt;/p&gt;

&lt;p&gt;Luckily &lt;a href=&quot;http://prototype-window.xilinus.com/&quot; title=&quot;Prototype Window Class&quot;&gt;PWC&lt;/a&gt; is built on Prototype which means we've already loaded a helpful library.&lt;/p&gt;

&lt;!--more--&gt;


&lt;p&gt;In order to take all &lt;code&gt;class=lbOn&lt;/code&gt; objects and run them through &lt;a href=&quot;http://prototype-window.xilinus.com/&quot; title=&quot;Prototype Window Class&quot;&gt;PWC&lt;/a&gt; we just write a simple loop and iterate.&lt;/p&gt;

&lt;p&gt;So here's the low-down:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Download &lt;a href=&quot;http://prototype-window.xilinus.com/&quot; title=&quot;Prototype Window Class&quot;&gt;PWC&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Copy window.js&lt;/li&gt;
&lt;li&gt;Use the included prototype &amp;amp; script.aculo.us if you don't already include it in your page&lt;/li&gt;
&lt;li&gt;copy any themes you wish to use.&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;In your page add this bit of JavaScript:&lt;/p&gt;

&lt;div&gt;&lt;textarea name=&quot;code&quot; class=&quot;js&quot;&gt;
    var mylb = Class.create();
    
    mylb.prototype = {
        initialize: function(ctrl) {
            this.content = ctrl.href;
            Event.observe(ctrl, 'click', this.activate.bindAsEventListener(this), false);
            ctrl.onclick = function(){return false;};
            },
    
            // Turn everything on - mainly the IE fixes
            activate: function(){
                var win = new Window('window_id', {className: &quot;alphacube&quot;,title: &quot;Tour&quot;, url: this.content, width:700, height:500});
                win.setDestroyOnClose();
                win.showCenter(true);
            }
        }

        lbox = document.getElementsByClassName('lbOn');
        for(i = 0; i &lt; lbox.length; i++) {
            valid = new mylb(lbox[i]);
        }
&lt;/textarea&gt;&lt;/div&gt;


&lt;p&gt;So, this code simply looks for all the anchor tags with &lt;code&gt;class=lbOn&lt;/code&gt; and then  creates a new &lt;code&gt;mylb&lt;/code&gt; instance for each anchor.  The end.&lt;/p&gt;
</content>
 </entry>
 

</feed>

