Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

About this user

Peter Cooperx http://www.petercooper.co.uk/

« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS 

Hacked Nifty Corners Rounded method

I didn't want to specify background colors at all for Nifty Corners, so I hacked the main method to automatically detect background colors to work with:

   1  
   2  function Rounded(selector,bk,color,size){
   3  	var i;
   4  	var v=getElementsBySelector(selector);
   5  	var l=v.length;
   6  	var bk = newGetStyle('body', 'background-color');
   7  	for(i=0;i<l;i++){
   8      color = newGetStyle(v[i].id, 'background-color'); 
   9      AddTop(v[i],bk,color,size);
  10      AddBottom(v[i],bk,color,size);
  11    }
  12  }
  13  
  14  function newGetStyle(nodeName, sStyle) {
  15  	var x = document.getElementById(nodeName);
  16  	if (x.currentStyle) {
  17  		var y = x.currentStyle[sStyle];
  18  	} else {
  19  		try {
  20  		var y = document.defaultView.getComputedStyle(x,null).getPropertyValue(sStyle);
  21  	  } catch(e) {
  22  	  }
  23  	}
  24  	return y;
  25  }
« Newer Snippets
Older Snippets »
Showing 1-1 of 1 total  RSS