0

I have the following code, which fades in HTML via a .load into a .pop-up modal.

$('.about').click(function(){
    $('.pop-up').load('about.php', function(){
        $(this).fadeIn();
    });

However, I need a second click to make the .about fade out. I understand certain toggle functions are now deprecated. Is there a current method I could use? I have a couple of these functions which will need toggling throughout the code.

Any help would be great.

2 Answers2

0
$('.about').click(function(){
  $('.pop-up').load('about.php', function(){
    $(this).toggle( "slow", function() {
    // Animation complete.
  });
});

http://api.jquery.com/toggle/

Rahul Kadukar
  • 858
  • 3
  • 15
  • 35
0

you can use toggle but by custom code you can do your customization very well

    var toggle=0;
    $('.about').click(function(){
   var $this=$('this');
    if(!toggle)
    {
    $('.pop-up').load('about.php', function(){
            $this.fadeIn();
          toogle=1;
        });
    }
    else{// or do other action which you want
           $this.fadeOut();
        toggle=0;

    }
    });
Rituraj ratan
  • 10,260
  • 8
  • 34
  • 55