4483 posts ThemeForest Senior Reviewer
  • Affiliate Level 1
  • Author Level 6
  • Collector Level 3
  • Envato Team
+14 more
Ivor
Envato team
says

js selectors != css selectors

I know that.

3007 posts
  • 5 Years of Membership
  • Affiliate Level 5
  • Author Level 9
  • Bundle Boss
+8 more
duotive
says


js selectors != css selectors
I know that.

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

2337 posts
  • Affiliate Level 5
  • Author Level 6
  • Collector Level 2
  • Trendsetter
+7 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
  • 5 Years of Membership
  • Affiliate Level 2
  • Collector Level 2
  • Exclusive Author
+1 more
wpCanyonThemes
says
4483 posts ThemeForest Senior Reviewer
  • Affiliate Level 1
  • Author Level 6
  • Collector Level 3
  • Envato Team
+14 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
  • 5 Years of Membership
  • Affiliate Level 2
  • Collector Level 2
  • Exclusive Author
+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. :)

4483 posts ThemeForest Senior Reviewer
  • Affiliate Level 1
  • Author Level 6
  • Collector Level 3
  • Envato Team
+14 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
  • 5 Years of Membership
  • Affiliate Level 2
  • Collector Level 2
  • Exclusive Author
+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