dylay
dylay copied to clipboard
Does not reposition when add an element to the dom
First of all, thank you for this amazing plugin. I played a little bit with that but I'm not too good with javascript unfortunately. So I need help.
I'm using this plugin on my main wall, but when the user add a new post i display it with mustache template and then i call the method position of dylay but doesn't happen anything or better the plugin doesn't recognizes the new element. how can i fix that?
Let's say this scenario
<div class="waller row">
<div class="col-md-6 time-line">Hey Man how are you?</div>
<div class="col-md-6 time-line">Hey Man What's up?</div>
<div class="col-md-6 time-line">Hey Man are you ok?</div>
</div>
var $dylay = jQuery('.waller');
// init the script
$dylay.dylay({
// speed of animation
speed: 800,
// make your animation yummy
// selector to define elements
selector: '.time-line'
});
Then i do a call ajax on the success method i append the result to my dom
success: function(data) {
post = { post : data };
$.Mustache.load('js/templates/wall/post.htm')
.done(function () {
// append the result to my doom
$('.waller .time-line:eq(0)').mustache('post-template', post, { method: 'after' });
});
$('.waller').dylay('position');
},
template:
<script id="post-template" type="text/x-handlebars-template">
<div class="col-md-6 time-line">{{post.result}}</div>
</script>
Hi, Can you try this :
success: function(data) {
post = { post : data };
$.Mustache.load('js/templates/wall/post.htm')
.done(function () {
// append the result to my doom
$('.waller .time-line:eq(0)').mustache('post-template', post, { method: 'after' });
$('.waller').dylay('position');
});
},
and thanks for using dylay
Thank you for this plugin really, in just 1.5k have this is really amazing need just to fix that. But anyway i tried that it doesn't work.
I tried even to don't call the mustache template and just append the element to the waller class but same. I really don't understand why the element is not bound to the plugin infact it doesn't give the position when is appended.
Thank you very much for your time
Is-it possible to send me per mail an archive with your example ?