Wednesday 15 June 2011

prettyPhoto with dynamic content JQuery AJAX -


Hello, I am loading this code via AJAX call, these are VEMEO videos and when I put the static code. But not with the dynamically loaded content, I tried many solutions but was not working for me but there would be any epiactive code:
  $ (document). Ready (function () {$ ("a [data-relay ^ = 'beautiful photo']"). PrettyPhoto (); $ ("category.") Click (function () {var categoryid = $ (this). Data ('clas Sid '); $. ({Url:' & lt ;? php echo base_url ()? & Gt; main / getPortfolioVideos', type: 'POST', data: {category_id: categoryid, page_slug: "index"}}) Done (function (data) {var rows = $. Parse (data); var videodata = ""; $ (rows) .each (function (index, value) {$ .each (value, function (k, v) { If (k == "video_link") {Videodata + = '& lt; article class = "entry" & gt; & lt; a data-relay = "beautiful photo" href = "http://vimeo.com/'+ V + '"& gt;' videodata + = '& lt; iframe src =" http://player.vimeo.com/video/'+ v +' "width =" 270 "height =" 160 "frameborder =" 0 "Webkitallowfullscreen =" "mozallowfullscreen =" "Permission =" "& gt; '; Videodata + = '& lt; / Iframe & gt; & Lt; Span class = "video-hover" & gt; & Lt; / Span & gt; & Lt; / A & gt; & Lt; / Article & gt; '; } Console.log (k + ":" + v); }); }) $ ("Portfolio"). Html (videodata); }); }); }); Sorry for the late reply, today I have the same problem. Therefore, I have decided it in the following way - just $ .exax has been added to the success function code, which is called a beautiful photo when new content is displayed.  

First, type the function-wrapper:

  function prettyPhotoLoad () {// Video preview $$ ("a [rel ^ = 'prettyPhoto']) PrettyPhoto ();}   

Apply beautiful photos when the document is ready:

  $ (document) .ready (function () {PrettyPhotoLoad ();}   

Call Ajax and renew beautiful photo:

  $ .ajax ({url: base_url + "/ ajax / ShowMoreWebResults ", success: function (myVal) {$ (  

Note: I have a problem with my problem using Paddy did I "$ (" A [rel ^ = 'prettyphoto'] "). PrettyPhoto ();" line. Thanks for the reply.

No comments:

Post a Comment