jquery - Fancybox: Prepend each relative html content from a list -
i'm trying prepend html content fancybox iframe modal. page in question has list of documents each own html content passed fancybox modal:
<div class="doc"> <a href="some_documenta.pdf" class="fancydoc" data-fancybox-type="iframe">document a</a> <div class="fancysharebuttons" style="display: none;"><a>love me</a></div> </div> <div class="doc"> <a href="some_documentb.pdf" class="fancydoc" data-fancybox-type="iframe">document b</a> <div class="fancysharebuttons" style="display: none;"><a>no, love me</a></div> </div> <div class="doc"> <a href="some_documentc.pdf" class="fancydoc" data-fancybox-type="iframe">document c</a> <div class="fancysharebuttons" style="display: none;"><a>actually, me want</a></div> </div>
i've followed advice previous post , modified needs:
$(".fancydoc").click(function() { $.fancybox({ fittoview : false, width : '90%', height : '90%', autosize : false, openeffect : 'none', closeeffect : 'none', closeclick : true, aftershow: function(){ var sharelinks = "<div class='fancytools clearfix'>" + $(".fancysharebuttons").html() + "</div>"; $('.fancybox-inner').prepend(sharelinks); }, afterclose: function(){ $(".fancybox-inner .fancytools").remove(); }, });
problem content first document's hidden .fancysharebuttons div prepended listed documents. need specify each linked doc want prepend relative content.
i've stabbed bit each.function , $(this) no avail.
any pointers?
thanks
try
$(".fancydoc").click(function() { var = $(this); $.fancybox({ fittoview : false, width : '90%', height : '90%', autosize : false, openeffect : 'none', closeeffect : 'none', closeclick : true, aftershow: function(){ var sharelinks = "<div class='fancytools clearfix'>" + that.next("div.fancysharebuttons").html() + "</div>"; $('.fancybox-inner').prepend(sharelinks); }, afterclose: function(){ $(".fancybox-inner .fancytools").remove(); }, });
Comments
Post a Comment