SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Feb 2007
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    On hover highlighter: works in firefox but not in IE

    Here is the code:
    Code:
    HighlightOnHover = Class.create();
    HighlightOnHover.prototype = {
      initialize: function(element, options) {
    		this.element = $(element);
    		this.options = Object.extend({
          highlightcolor: "#99D6FF",
          highlightendcolor: "#FFFFFF",
        }, options || {});
    
    	this.onclickListener = this.enterEditMode.bindAsEventListener(this);
        this.mouseoverListener = this.enterHover.bindAsEventListener(this);
        this.mouseoutListener = this.leaveHover.bindAsEventListener(this);
        Event.observe(this.element, 'click', this.onclickListener);
        Event.observe(this.element, 'mouseover', this.mouseoverListener);
        Event.observe(this.element, 'mouseout', this.mouseoutListener);
    	
    	this.originalBackground = Element.getStyle(this.element, 'background-color');
        if (!this.originalBackground) {
          this.originalBackground = "transparent";
        }
    
    	},
    	enterHover: function() {
        this.element.style.backgroundColor = this.options.highlightcolor;
        if (this.effect) {
          this.effect.cancel();
        }
      },
      leaveHover: function() {
        this.effect = new Effect.Highlight(this.element, {
          startcolor: this.options.highlightcolor,
          endcolor: this.options.highlightendcolor,
          restorecolor: this.originalBackground/*, duration:0.1*/
        });
      },
      enterEditMode: function() {
    	this.element.style.backgroundColor = this.originalBackground;
      }
    };
    you can also check the site http://www.simplegtd.com/users/demo_login

    each item on this page is highlighted onhover in firefox but i get a error in IE. I cant get my head around it, tried lots of permutations but couldn't figure out a solution.

    please help.


    thanks

  2. #2
    SitePoint Wizard
    Join Date
    Mar 2001
    Posts
    3,537
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Email the person who wrote the library and complain.

  3. #3
    SitePoint Member
    Join Date
    Feb 2007
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well I have modified the code of Ajax.InplaceEditor (scriptaculous library) and took only those parts which made the div highlight.

    Ajax.InPlaceEditor highlighting work fine in both IE and fire fox,
    but my code gets error "HighlightOnHover" not defined in IE only.

    I hope someone can help me on this one.

    the code I posted earlier is complete. so if any one can look at it and tell me what I am missing.

    thanks.


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
  •