/    Sign up×
Community /Pin to ProfileBookmark

jQuery show/hide

Hi Guys!
I found one great solution for show/hide JQuery but i can’t figure out how to make JS,css and html code all together, so please if anybody can make that code together for me and post me here!

-Thanks in advance!!!

here is code with example:

[url]http://jsfiddle.net/9XmVT/14/[/url]

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@JBizzMar 13.2011 — Is this what you are trying to achieve?

http://jsfiddle.net/JohnnyBizzel/9XmVT/254/
Copy linkTweet thisAlerts:
@remaeisauthorMar 13.2011 — Yes, thats it! but i already solve problem, and working perfect now:

<script src="jquery.min.js"></script>

<style>

.example{

width:100px;height:50px;background:gray;border:solid 1px #000;padding:10px;

}

</style>

<div style="position:absolute;top:100px;left:100px;"> <a href='#' id="example"> some link </a></div>

<div class="example">

--- Click outside div ---

</div>

<script>

var fieldExample = $('#example');

$('div.example').css({

"position":"absolute",

"left": fieldExample.offset().left,

"top": fieldExample.offset().top + fieldExample.outerHeight()

});

fieldExample.focus(function() {

var div = $('div.example').show();

$(document).bind('focusin.example click.example',function(e) {

if ($(e.target).closest('.example, #example').length) return;

$(document).unbind('.example');

div.fadeOut('slow');

});

});

$('div.example').hide();

</script>

PS:i just check it with more div's, and all working great!!!

-thanks!
×

Success!

Help @remaeis 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 6.16,
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: @nearjob,
tipped: article
amount: 1000 SATS,

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

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...