/    Sign up×
Community /Pin to ProfileBookmark

Drop shadow effects

Hi everyone –

I am trying to implement a drop shadow effect to cells in a grid.

The basic premise is when a user clicks in the cell,
it is replaced with an edit box with a nice drop shadow
effect under it.

does anyone have any pointers on accomplishing this task?

thanks
tony

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@methodpgDec 30.2005 — If you want a cross-browser, translucent drop-shadow... you could put a DIV beneath the edit box, using the follow CSS:

[CODE]
{
position: absolute;
z-index: 200;
top: 0px;
left: 0px;
width: 100%;
height: 100%;
opacity: .4;
filter: alpha(opacity=40);
/* this hack is so it works in IE */
background-color:transparent !important;
background-color: #333333;
/* this hack is for opera support
* you can uncomment the background-image if you don't care about opera.
* this gives you the flexibility to use any bg color that you want, instead of the png
*/
background-image/**/: url("maskBG.png") !important; // For browsers Moz, Opera, etc.
background-image:none;
background-repeat: repeat;
display:none;
}
[/CODE]


Of course, you'd need to put the DIV in the right place, etc. but that CSS should allow to create semi-transparent DIVs that work on almost all browsers (apparently)
Copy linkTweet thisAlerts:
@pithhelmetauthorDec 30.2005 — Thanks for the post -

i understand the logic, but the implementation escapes me...

perhaps a small sample...

thanks again

take care

tony
Copy linkTweet thisAlerts:
@methodpgDec 30.2005 — This is where cross-browser stuff gets the best of me..

generally.. if you have an input or textarea field.. and give it an ID (matching it's NAME preferably) you can probably reference that and then position and size the DIV accordingly.

(In this example "myInputId" will be a cell's edit-box input/field)

[CODE]
var shadowOffset=4;

document.getElementById('myShadowDiv').width = document.getElementById('myInputId').width;

document.getElementById('myShadowDiv').height= document.getElementById('myInputId').height;

document.getElementById('myShadowDiv').top= document.getElementById('myInputId').top+parseInt(shadowOffset);

document.getElementById('myShadowDiv').left= document.getElementById('myInputId').left+parseInt(shadowOffset);
[/CODE]


Though.. i think you may need to replace some of those with offsetWidth / offsetHeight / etc. Hopefully someone will let me know if I've made a mistake there. ?
×

Success!

Help @pithhelmet spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...