4327 posts ThemeForest Reviewer
  • Has referred 1+ members
  • Has sold $40,000+ on Envato Market
  • Has collected 50+ items on Envato Market
  • Member of the Envato Team
+12 more
Ivor Envato team says

js selectors != css selectors

I know that.

3007 posts
  • Has been part of the Envato Community for over 4 years
  • Has referred 200+ members
  • Has sold $250,000+ on Envato Market
  • Had an item featured in an Envato Bundle
+7 more
duotive says


js selectors != css selectors
I know that.

than you can be sure that it will work on ie7 :) no problem there

2324 posts
  • Has referred 100+ members
  • Has sold $40,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Helped several times protecting Envato Market against copyright violations
+6 more
CreativeMilk says

He Ivor, i have made the same snippet a while back, i think it whas for an project or so…....have to digg true my files

1383 posts
  • Has been part of the Envato Community for over 4 years
  • Has referred 10+ members
  • Has collected 10+ items on Envato Market
  • Sells items exclusively on Envato Market
+1 more
wpCanyonThemes says
4327 posts ThemeForest Reviewer
  • Has referred 1+ members
  • Has sold $40,000+ on Envato Market
  • Has collected 50+ items on Envato Market
  • Member of the Envato Team
+12 more
Ivor Envato team says

http://api.jquery.com/focusout/ You’re welcome. :)

Thanks I didn’t knew about the focusout event; I did this and is looking great:

jQuery('a#open').click(function () {
    jQuery('a#open').fadeOut();
    jQuery('#search').stop().animate({ "top": "0px" }, "slow").append('<a href="#" id="close">Close</a>');
});
// The 'close' link is generated dinamically, I have to use the .live() method
jQuery('a#close').live('click', function() {
    jQuery('#search').stop().animate({ "top": "-55px" }, "slow");
    jQuery('a#open').fadeIn();
    jQuery('a#close').fadeOut();    
});
1383 posts
  • Has been part of the Envato Community for over 4 years
  • Has referred 10+ members
  • Has collected 10+ items on Envato Market
  • Sells items exclusively on Envato Market
+1 more
wpCanyonThemes says


http://api.jquery.com/focusout/ You’re welcome. :)

Thanks I didn’t knew about the focusout event; I did this and is looking great:

jQuery('a#open').click(function () {
    jQuery('a#open').fadeOut();
    jQuery('#search').stop().animate({ "top": "0px" }, "slow").append('<a href="#" id="close">Close</a>');
});
// The 'close' link is generated dinamically, I have to use the .live() method
jQuery('a#close').live('click', function() {
    jQuery('#search').stop().animate({ "top": "-55px" }, "slow");
    jQuery('a#open').fadeIn();
    jQuery('a#close').fadeOut();    
});

Use

jQuery(document).ready(function($){

});

Notice the $ in the function() part. That way you don’t have to use jQuery all the time, you can use $. Or anything else, if you put “hellyeah” inside () you can use hellyeah(‘selector’)...

Also you can use $(this) in the first event instead of $(‘a#open’) and the same for the $(‘a#close’) in the second one.

Also from what i can see, it will continue to create new instances of the anchor with id #close every time you click the a#open. Either use jQuery(‘a#close’).fadeOut().remove(); in the second event or just add the a#close to be there by default with display:none, remove the part for appending it and use fadeIn() in the first event.

Hope i helped. :)

4327 posts ThemeForest Reviewer
  • Has referred 1+ members
  • Has sold $40,000+ on Envato Market
  • Has collected 50+ items on Envato Market
  • Member of the Envato Team
+12 more
Ivor Envato team says

Hey wpCanyonThemes thanks a lot man I’m now using var j = jQuery.noConflict(); and thanks for the rest man now is working perfectly.

1383 posts
  • Has been part of the Envato Community for over 4 years
  • Has referred 10+ members
  • Has collected 10+ items on Envato Market
  • Sells items exclusively on Envato Market
+1 more
wpCanyonThemes says

You’re welcome. :)

Before i started my blog on WordPress development i had a little blog (70K pageviews per month) on jQuery development, so whenever you have a prob with jQuery post it up on the forum and i’ll try to help you. Same goes for everyone else.

by
by
by
by
by
by