Results 1 to 3 of 3

Thread: Lightbox Help Onmouseover

  1. #1
    Join Date
    Aug 2008
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Lightbox Help Onmouseover

    1) Script Title: Lightbox V 2.0.4

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...box2/index.htm

    3) Describe problem: Simply put, is there anyway to have the image viewer window open onmouseover rather than onclick? If I use rel="lightbox" , then I have to click on the image for the viewer to open. I would rather need the image to open onmouseover

    Thanks in advance

  2. #2
    Join Date
    Feb 2008
    Location
    Cebu City Philippines
    Posts
    1,160
    Thanks
    17
    Thanked 277 Times in 275 Posts

    Default

    Go to lightbox.js. Find this part (found in lightbox.prototype):
    Code:
    Lightbox.prototype = {
    	
    	// initialize()
    	// Constructor runs on completion of the DOM loading. Loops through anchor tags looking for 
    	// 'lightbox' references and applies onclick events to appropriate links. The 2nd section of
    	// the function inserts html at the bottom of the page which is used to display the shadow 
    	// overlay and the image container.
    	//
    	initialize: function() {	
    		if (!document.getElementsByTagName){ return; }
    		var anchors = document.getElementsByTagName('a');
    		var areas = document.getElementsByTagName('area');
    
    		// loop through all anchor tags
    		for (var i=0; i<anchors.length; i++){
    			var anchor = anchors[i];
    			
    			var relAttribute = String(anchor.getAttribute('rel'));
    			
    			// use the string.match() method to catch 'lightbox' references in the rel attribute
    			if (anchor.getAttribute('href') && (relAttribute.toLowerCase().match('lightbox'))){
    				anchor.onclick = function () {myLightbox.start(this); return false;}
    			}
    		}
    Change highlighted with onmouseover instead and see if that helps.
    Learn how to code at 02geek

    The more you learn, the more you'll realize there's much more to learn
    Ray.ph!

  3. The Following User Says Thank You to rangana For This Useful Post:

    frank95a (08-12-2008)

  4. #3
    Join Date
    Aug 2008
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Thanks so much... It worked like a charm

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •