F. Certainly.
F. Certainly.

Reputation: 179

How to style, or contain in a div, content loading with jqueries .load()? Another quicky

The content I'm loading with jquery .load() takes up too much of the screen when it loads into a small div?

Anyone know what's going on here? Any way to style content while it's in transition?

$('.selector').hide("slide",{direction:"right"},1000,function() {$('.display').load('..content/content.php')});

$('.selector').show("slide",{direction:"left"},1000);

Upvotes: 0

Views: 30

Answers (1)

NimaNr
NimaNr

Reputation: 542

You can handle it in many different visual style, I will give two examples:

  1. Sytle the $('.display') to be hidden by default, then on the success callback of load() (third parameter), style it to become visible
  2. Give .diplay a style of fixed height, while the container (the .selector) has the style of overflow: hidden, then when the animation is finished, turn it back to overflow: none

generally, your problem is with animation. Also, I recommend using the function $.ajax() which gives you more control over the flow of loading. It has many more callbacks.

Upvotes: 1

Related Questions