I’m using Jquery UI to allow the user to resize a div with a video player in it.
This is a excerpt of the code:
<script type="text/javascript">
$(function(){
$("#stream").resizable({
containment: "#content",
minHeight: $('#content').height(),
maxWidth: ($('#content').width() / 1.3)
});
});
</script>
<div id="stream">
<!-- Flash video player stuff -->
</div>
This works as expected when the page is rendered. The problem is when I trigger an event that changes the contents of the “#stream” div with:
#('#stream').html(<--!Code for another video player-->);
After doing this the resize controls disappear and even if I invoke $("#stream").resize() again is does not seem to work.
Am I doing something wrong or do I need to use some sort of work around?
The widget will still operate under the parameters you specified on creation, even if
#contentitself changes. You can either completelydestroythe widget and recreate it:Or, less intrusively, use the
optionmethod to update its operating parameters: