So I wanted to be able to have a lightwidow open up on mouseover, but couldn’t find an easy way to do this, especially not without having to embed scripts in the page, which is a huge pain within a wordpress post (though I do have TextControl installed now, but still). Anyways, this implementation is as follows:
For a normal lightwindow link, you simply add class = "lightwindow" to the link tag. For a link to become mouseover friendly, add class = "lightwindow_over" instead.
There are a few changes that then must be made to the lightwindow.js file:
First, edit Lightwindow.initialize (should be around line 95, “initialize : function(options) {…”). Go down to where the classNames are defined and add another definition, “over”. It should then look like this:
classNames : {
standard : 'lightwindow',
over : 'lightwindow_over',
action : 'lightwindow_action'
},
The other two functions that you must modify are _setupLinks and _processLink, which should be around line 480.
//
// Set Links Up
//
_setupLinks : function() {
var links = $$('.'+this.options.classNames.standard);
links.each(function(link) {
this._processLink(link,"click");
}.bind(this));
var overs = $$('.'+this.options.classNames.over);
overs.each(function(link) {
this._processLink(link,"mouseover");
}.bind(this));
},
then _processLinks… change the function definition so you can pass the trigger you want to use to launch the lightwindow:
Event.observe(link, selector, this.activate.bindAsEventListener(this, link), false);
link.onMouseOver = function() {return false;};
yay.
0 Responses to “Lightwindow Mod: Enabling OnMouseOver Activation”