This article introduces an example of using the Floatbox plug-in Javascript in ajax callback. For more information, see.
The Code is as follows: |
Copy code |
<Script type = "text/javascript"> Function open_adjacent (sDiv, BoxLeft, BoxTop ){ If((('{dialogadjacent'}.html () = null ){ $. Ajax ({ Type: "GET ", Url: wgScript + "/Special: TermWiki_Ajax ", DataType: "json", data: {action: "getAdjacent", ns: wgCanonicalNamespace, pname: encodeURIComponent (wgTitle )}, Success: function (html ){ If (html ){ Var aTerms = html; Var sHtml = ""; SHtml + = '<div class = "TermLinks" id = "dialogAdjacent"> <table> '; For (var I = 0, j = aTerms. length; I <j; I ++ ){ If (wgTitle = aTerms [I]) { SHtml + = '<tr> <td style = "padding: 2px 0em 0pt 1em; font-size: 12px "> <strong class =" selflink "> '+ aTerms [I] +' </strong> </td> </tr> '; } Else { SHtml + = '<tr> <td style = "padding: 2px 0em 0pt 1em; font-size: 12px"> <a href = "/' + wgCanonicalNamespace + ': '+ encodeURIComponent (aTerms [I]) + '"title ="' + aTerms [I] + '">' + aTerms [I] + '</a> </td> </tr> '; } } SHtml + = '</table> </div> '; $ ('# TermAdjacent'). append (sHtml ); } Fb. start ({href: sDiv, rev: 'width: 150 height: 170 padding: 18 panelPadding: 5 overlayOpacity: 0 shadowType: drop shadowSize: 12 scrolling: true enableDragMove: true boxLeft: '+ BoxLeft + 'boxtop:' + boxTop }); } }); } Else { Fb. start ({href: sDiv, rev: 'width: 150 height: 170 padding: 18 panelPadding: 5 overlayOpacity: 0 shadowType: drop shadowSize: 12 scrolling: true enableDragMove: true boxLeft: '+ BoxLeft + 'boxtop:' + boxTop });
} } </Script> |