- Envato Staff
- Reviewer
- Community Moderator
- Venezuela
- Has been a member for 4-5 years
- Repeatedly Helped protect Envato Marketplaces against copyright violations
- Microlancer Beta Tester
- Sold between 10 000 and 50 000 dollars
- Exclusive Author
Hey guys the code is commented and you’ll see what I’m trying to do. My question is: Is ok to apply the click method to the body? I don’t want troubles 
// When the user hover the open button
jQuery('a#open').hover(function () {
// The Search box will animate
jQuery('#search').stop().animate({ "top": "0px" }, "slow");
// And the open link will disappear
jQuery('a#open').fadeOut();
});
// When the user clicks outside the searchbox it'll slideUp
jQuery('body').click(function () {
jQuery('#search').stop().animate({ "top": "-55px" }, "slow");
// And the open button will appear
jQuery('a#open').fadeIn();
});
EDIT : Yes this will give me issues, how I’m supposed to place the cursor inside the input form? It’ll slide up. Damn! Any ideas?
- Author had a Free File of the Month
- Author was Featured
- Bought between 10 and 49 items
- Egypt
- Exclusive Author
- Has been a member for 2-3 years
- Item was Featured
- Referred between 10 and 49 users
- Sold between 10 000 and 50 000 dollars
jQuery(':not(#search)').click(function () {
jQuery('#search').stop().animate({ "top": "-55px" }, "slow");
// And the open button will appear
jQuery('a#open').fadeIn();
});
- Sold between 50 000 and 100 000 dollars
- Author was Featured
- Item was Featured
- Grew a moustache for the Envato Movember competition
- Beta Tester
- Spain
- Has been a member for 3-4 years
- Interviewed on the Envato Notes blog
What about a mouseleave() on the input text? Supposing your user is clicking inside the input to type what he is looking for without moving his mouse out.
- Author had a File in an Envato Bundle
- Author was Featured
- Bought between 1 and 9 items
- Europe
- Exclusive Author
- Has been a member for 2-3 years
- Item was Featured
- Referred between 100 and 199 users
wizylabs said
jQuery(':not(#search)').click(function () { jQuery('#search').stop().animate({ "top": "-55px" }, "slow"); // And the open button will appear jQuery('a#open').fadeIn(); });
nice selector wiz
- Envato Staff
- Reviewer
- Community Moderator
- Venezuela
- Has been a member for 4-5 years
- Repeatedly Helped protect Envato Marketplaces against copyright violations
- Microlancer Beta Tester
- Sold between 10 000 and 50 000 dollars
- Exclusive Author
:not is a css3 selector, it won’t work in IE7 and 8 
- Author had a Free File of the Month
- Author was Featured
- Bought between 10 and 49 items
- Egypt
- Exclusive Author
- Has been a member for 2-3 years
- Item was Featured
- Referred between 10 and 49 users
- Sold between 10 000 and 50 000 dollars
IvorPadilla said
:not is a css3 selector, it won’t work in IE7 and 8![]()
It will in jQuery, jQuery have developed their own one 
- Envato Staff
- Reviewer
- Community Moderator
- Venezuela
- Has been a member for 4-5 years
- Repeatedly Helped protect Envato Marketplaces against copyright violations
- Microlancer Beta Tester
- Sold between 10 000 and 50 000 dollars
- Exclusive Author
wizylabs said
IvorPadilla saidIt will in jQuery, jQuery have developed their own one
:not is a css3 selector, it won’t work in IE7 and 8![]()
![]()
Thanks man, I’m trying
jQuery('body').not('#search').click(function () {
jQuery('#search').stop().animate({ "top": "-55px" }, "slow");
// And the open button will appear
jQuery('a#open').fadeIn();
});
But it doesn’t work 
- Author had a Free File of the Month
- Author was Featured
- Bought between 10 and 49 items
- Egypt
- Exclusive Author
- Has been a member for 2-3 years
- Item was Featured
- Referred between 10 and 49 users
- Sold between 10 000 and 50 000 dollars
IvorPadilla said
wizylabs said
IvorPadilla saidIt will in jQuery, jQuery have developed their own one
:not is a css3 selector, it won’t work in IE7 and 8![]()
![]()
Thanks man, I’m trying
jQuery('body').not('#search').click(function () { jQuery('#search').stop().animate({ "top": "-55px" }, "slow"); // And the open button will appear jQuery('a#open').fadeIn(); });But it doesn’t work![]()
now try this and test it in IE7 and see what happens 
jQuery(':not(#search)').click(function () {
jQuery('#search').stop().animate({ "top": "-55px" }, "slow");
// And the open button will appear
jQuery('a#open').fadeIn();
});
- Author had a File in an Envato Bundle
- Author was Featured
- Bought between 1 and 9 items
- Europe
- Exclusive Author
- Has been a member for 2-3 years
- Item was Featured
- Referred between 100 and 199 users
js selectors != css selectors
- Author had a Free File of the Month
- Author was Featured
- Bought between 10 and 49 items
- Egypt
- Exclusive Author
- Has been a member for 2-3 years
- Item was Featured
- Referred between 10 and 49 users
- Sold between 10 000 and 50 000 dollars
duotive said
js selectors != css selectors
+1
