d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > Remove Flashing Effect From Div
Add Reply New Topic New Poll
Member
Posts: 476
Joined: Dec 2 2007
Gold: 35.00
Sep 16 2012 02:21pm
I have a small conflict that causes one of my links to stop functioning in Google Chrome/Firefox when this event is triggered... The function simply doesn't work in internet explorer - however instead of fixing the problem in internet explorer, I'd like to remove the functionality so that the conflict doesn't happen in Firefox/Chrome

There is a significant portion of this code that is dependent on the rest of the moduel to work, someone said "just change the flash color to white" but it dosent fix the problem of interfearing with the links in Chrome/Firefox... So I was wondering if someone could give me an example of what I would have to rem, to prevent it from listening for and triggering the "Div Color Flash"

i'm not so great with java.... pretty bad acctually... anyone help? please...

i'll give u some FG for it


Code
/**
/**
* This function searches for all elements with the class name "vmCartModule" and
* updates them with the contents of the page "shop.basket_short" after a cart modification event
*/
function updateMiniCarts() {
var callbackCart = function(responseText) {
 carts = $$( '.vmCartModule' );
 if( carts ) {
  try {
   for (var i=0; i<carts.length; i++){
    carts[i].innerHTML = responseText;
 
    try {
     color = carts[i].getStyle( 'color' );
     bgcolor = carts[i].getStyle( 'background-color' );
     if( bgcolor == 'transparent' ) {
      // If the current element has no background color, it is transparent.
      // We can't make a highlight without knowing about the real background color,
      // so let's loop up to the next parent that has a BG Color
      parent = carts[i].getParent();
      while( parent && bgcolor == 'transparent' ) {
       bgcolor = parent.getStyle( 'background-color' );
       parent = parent.getParent();
      }
     }
     var fxc = new Fx.Style(carts[i], 'color', {duration: 1000});
     var fxbgc = new Fx.Style(carts[i], 'background-color', {duration: 1000});

     fxc.start( '#222', color );    
     fxbgc.start( '#fff68f', bgcolor );
     if( parent ) {
      setTimeout( "carts[" + i + "].setStyle( 'background-color', 'transparent' )", 1000 );
     }
    } catch(e) {}
   }
  } catch(e) {}
 }
}
var option = { method: 'post', onComplete: callbackCart, data: { only_page:1,page: "shop.basket_short", option: "com_virtuemart" } }
new Ajax( live_site + '/index2.php', option).request();


}
Member
Posts: 62,873
Joined: Aug 2 2009
Gold: 1,189.90
Sep 16 2012 06:32pm
In here:
Code
var fxc = new Fx.Style(carts[i], 'color', {duration: 1000});
    var fxbgc = new Fx.Style(carts[i], 'background-color', {duration: 1000});

    fxc.start( '#222', color );    
    fxbgc.start( '#fff68f', bgcolor );


A test for internet explorer in javascript from CSS Tricks: http://css-tricks.com/snippets/javascript/test-for-ie-in-javascript/
Code
var isMSIE = /*@cc_on!@*/0;

if (isMSIE) {
 // do IE-specific things
} else {
 // do non IE-specific things
}



So the resulting code would be:
Code

var isMSIE = /*@cc_on!@*/0;

if (!isMSIE) {
    var fxc = new Fx.Style(carts[i], 'color', {duration: 1000});
    var fxbgc = new Fx.Style(carts[i], 'background-color', {duration: 1000});

    fxc.start( '#222', color );    
    fxbgc.start( '#fff68f', bgcolor );
}



This is my first time encountering something like this, I'm somewhat of a beginner at JaveScript, but let me know if that solved your problem.

Also, if any other frequenters of the forum have a better solution, feel free to flame me and tell me why I'm wrong ;)
Member
Posts: 476
Joined: Dec 2 2007
Gold: 35.00
Sep 17 2012 11:06am
This did not resolve the issue, let me be a bit more text oriented in how I word this online


The function simply doesn't work in internet explorer - however instead of fixing the problem in internet explorer, I'd like to remove the functionality so that the conflict doesn't happen in Firefox/Chrome

There is a significant portion of this code that is dependent on the rest of the moduel to work

So there would be as a result, no flashing going on at all regardless of browser, without faking it and flashing it the BG Color

This post was edited by exo232 on Sep 17 2012 11:07am
Member
Posts: 62,873
Joined: Aug 2 2009
Gold: 1,189.90
Sep 17 2012 06:23pm
Quote (exo232 @ Sep 17 2012 10:06am)
This did not resolve the issue, let me be a bit more text oriented in how I word this online


The function simply doesn't work in internet explorer - however instead of fixing the problem in internet explorer, I'd like to remove the functionality so that the conflict doesn't happen in Firefox/Chrome

There is a significant portion of this code that is dependent on the rest of the moduel to work

So there would be as a result, no flashing going on at all regardless of browser, without faking it and flashing it the BG Color


How about this?
Code
/**
/**
* This function searches for all elements with the class name "vmCartModule" and
* updates them with the contents of the page "shop.basket_short" after a cart modification event
*/
function updateMiniCarts() {
var isMSIE = /*@cc_on!@*/0;

if (isMSIE) {
var callbackCart = function(responseText) {
carts = $$( '.vmCartModule' );
if( carts ) {
 try {
  for (var i=0; i<carts.length; i++){
   carts[i].innerHTML = responseText;

   try {
    color = carts[i].getStyle( 'color' );
    bgcolor = carts[i].getStyle( 'background-color' );
    if( bgcolor == 'transparent' ) {
     // If the current element has no background color, it is transparent.
     // We can't make a highlight without knowing about the real background color,
     // so let's loop up to the next parent that has a BG Color
     parent = carts[i].getParent();
     while( parent && bgcolor == 'transparent' ) {
      bgcolor = parent.getStyle( 'background-color' );
      parent = parent.getParent();
     }
    }
    var fxc = new Fx.Style(carts[i], 'color', {duration: 1000});
    var fxbgc = new Fx.Style(carts[i], 'background-color', {duration: 1000});

    fxc.start( '#222', color );    
    fxbgc.start( '#fff68f', bgcolor );
    if( parent ) {
     setTimeout( "carts[" + i + "].setStyle( 'background-color', 'transparent' )", 1000 );
    }
   } catch(e) {}
  }
 } catch(e) {}
}
}
var option = { method: 'post', onComplete: callbackCart, data: { only_page:1,page: "shop.basket_short", option: "com_virtuemart" } }
new Ajax( live_site + '/index2.php', option).request();
}

}


Added an if statement that encompassed the entire function.
Go Back To Programming & Development Topic List
Add Reply New Topic New Poll