JavaScript ajax show container not animating as expected

I am writing a plugin for showing ajax content.It is wrapped in a ajax-content-wrap.I have applied jquery animate() but not smooth with auto height.And fade() function is also animating.But when i use a specific height animate() works and fadeIn() does not works.

my html codes are below

<div class="ajax-content-wrap">
   <div class="ajax-content-show">
      //here to show contents from external files
   </div>
</div>

My jquery

$('.ajax-content-show').animate({height:'200px'}, function(){
    $(this).fadeIn('slow', function(){
      $(this).fadeIn('slow').load(url);
    })
});

My css

.ajax-content-show{
   padding: 20px 20px;
   display: block;
   border: 1px solid #eee;
   margin: 10px 0;
}
Answer:1

If I understand what you are trying to acheive here is a solution:

$('.ajax-content-show').animate({
    height: '200'
}, 500, "linear",

function () {
    $('.ajax-content-show').hide(0, function () {
        $('.ajax-content-show').load(url, function () {
            $('.ajax-content-show').fadeIn('slow')
        });
    });
});  

If not, can you explain (in steps) what you require, first make "div" 200px then fade in "loaded page" or do them both simultaneously?

Note: Don't need to include the 'px' when setting the height property, JQuery assumes pixels as a default.

Answer:2

I have been trying to write a python script to allow me to harvest QR codes from whatsapp web. I use selenium but can't seem to get it to write. The QR image is a PNG generated by a javascript live (...

I have been trying to write a python script to allow me to harvest QR codes from whatsapp web. I use selenium but can't seem to get it to write. The QR image is a PNG generated by a javascript live (...

I am customising Sage CRM, so I have no control over the HTML that is written and can't add IDs or class's to the table layouts the CRM spits out. I want to hide a higher (not top) level table based ...

I am customising Sage CRM, so I have no control over the HTML that is written and can't add IDs or class's to the table layouts the CRM spits out. I want to hide a higher (not top) level table based ...

  1. jquery find parent with class
  2. jquery find parent element
  3. jquery find parent tr
  4. jquery find parent div
  5. jquery find parent form
  6. jquery find parent with attribute
  7. jquery find parent with id
  8. jquery find parent with class name
  9. jquery find parent td
  10. jquery find parent table
  11. jquery find parent li
  12. jquery find parent of parent
  13. jquery find parent row
  14. jquery find parent matching selector
  15. jquery find parent sibling child
  16. jquery find parent or grandparent
  17. jquery find parent with data attribute
  18. jquery find parent until
  19. jquery find parent sibling
  20. jquery find parent tr of td

I hope questions from beginners are acceptable. I don't mind studying, but based on research so far, I'm not sure where to even begin........ I'm in need of a script that can fit into a small URI ...

I hope questions from beginners are acceptable. I don't mind studying, but based on research so far, I'm not sure where to even begin........ I'm in need of a script that can fit into a small URI ...

I have a javascript code like this and this always gives me a problem for(var i=1;i<9;i++){ document.getElementById('element'+i).onclick=function(){ theFunc(i) } ...

I have a javascript code like this and this always gives me a problem for(var i=1;i<9;i++){ document.getElementById('element'+i).onclick=function(){ theFunc(i) } ...

  1. writing javascript variable in html
  2. writing javascript in variable