javascript - Creating an iframe from JQuery - properties are not working, why not? -
hello im creating iframe in javascript. style , loaded event doesnt seem work. doing wrong?
var iframe = $("<iframe src='/player/showpage/"+data.pageid+"'/>", { style: "position:absolute; left:-100%", load: function () { var = this; $(this).animate({ left: 0 }, 500); $('iframe').not(this).animate({ left: '-100%' }, 500, function () { $('iframe').not(that).remove(); }); } }); $('body').append(iframe);
i must missing something, cant figure out is. iframe sitting there - mocking me - on screen...
you need move 'src' object literal , works fine.
var iframe = $("<iframe>", { src: '/player/showpage/' + data.pageid, style: "position:absolute; left:-100%", load: function () { var = this; $(this).animate({ left: 0 }, 500); $('iframe').not(this).animate({ left: '-100%' }, 500, function () { $('iframe').not(that).remove(); }); } }); $('body').append(iframe);
please check jsfiddle working demo.
Comments
Post a Comment