Loading... <p style="margin-top:0px;margin-bottom:0px;padding:0px;border:0px;line-height:25px;color:#2A2C29;font-family:'Microsoft Yahei';font-size:14px;white-space:normal;background-color:#E1E6E0;"> <span style="margin:0px;padding:0px;border:0px;line-height:1.5;"><strong style="margin:0px;padding:0px;border:0px;transition-duration:0.4s, 0.5s;transition-property:background-color, color;transition-timing-function:ease, ease;">准备文件</strong> </span> </p> <p style="margin-top:0px;margin-bottom:0px;padding:0px;border:0px;line-height:25px;color:#2A2C29;font-family:'Microsoft Yahei';font-size:14px;white-space:normal;background-color:#E1E6E0;"> <span style="margin:0px;padding:0px;border:0px;line-height:1.5;">编辑模板 header.php 的 head 添加必要文件:</span> </p> <p style="margin-top:0px;margin-bottom:0px;padding:0px;border:0px;line-height:25px;color:#2A2C29;font-family:'Microsoft Yahei';font-size:14px;white-space:normal;background-color:#E1E6E0;"> <span style="margin:0px;padding:0px;border:0px;line-height:1.5;"></span> </p> <div class="precode" style="margin:0px;padding:0px;border:0px;max-width:698px;color:#2A2C29;font-family:'Microsoft Yahei';font-size:14px;line-height:25px;white-space:normal;position:relative;background-color:#E1E6E0;"> <button class="copy_code" style="margin:0px;padding:5px 10px;border:0px;position:absolute;top:0px;right:0px;color:#FFFFFF;cursor:pointer;background:#EA5A47;">复制</button> <pre class="prettyprint lang-js linenums" style="margin-top:10px;margin-bottom:10px;padding:10px 15px;border:1px dashed green;position:relative;overflow:auto;width:auto;color:#555555;word-wrap:break-word;font-stretch:normal;max-width:698px;background-color:#FFFFE0;"><script src="http://libs.cdnjs.net/jquery/1.11.1/jquery.min.js"></script> <script src="http://libs.cdnjs.net/jquery.pjax/1.8.2/jquery.pjax.min.js"></script></pre> </div> <div> <p style="margin-top:0px;margin-bottom:0px;padding:0px;border:0px;line-height:25px;color:#2A2C29;font-family:'Microsoft Yahei';font-size:14px;white-space:normal;background-color:#E1E6E0;"> <strong style="margin:0px;padding:0px;border:0px;transition-duration:0.4s, 0.5s;transition-property:background-color, color;transition-timing-function:ease, ease;">使用pjax</strong> </p> <p style="margin-top:0px;margin-bottom:0px;padding:0px;border:0px;line-height:25px;color:#2A2C29;font-family:'Microsoft Yahei';font-size:14px;white-space:normal;background-color:#E1E6E0;"> 编辑模版 footer.php 在/body标记结束前插入: </p> <div class="precode" style="margin:0px;padding:0px;border:0px;max-width:698px;color:#2A2C29;font-family:'Microsoft Yahei';font-size:14px;line-height:25px;white-space:normal;position:relative;background-color:#E1E6E0;"> <button class="copy_code" style="margin:0px;padding:5px 10px;border:0px;position:absolute;top:0px;right:0px;color:#FFFFFF;cursor:pointer;background:#EA5A47;">复制</button> <pre class="prettyprint lang-js linenums" style="margin-top:10px;margin-bottom:10px;padding:10px 15px;border:1px dashed green;position:relative;overflow:auto;width:auto;color:#555555;word-wrap:break-word;font-stretch:normal;max-width:698px;background-color:#FFFFE0;"> <script type="text/javascript"> $(document).pjax('a[target!=_blank]', '#contentleft', {fragment: '#contentleft',timeout: 8000}); </script></pre> </div> <p style="margin-top:0px;margin-bottom:0px;padding:0px;border:0px;line-height:25px;color:#2A2C29;font-family:'Microsoft Yahei';font-size:14px;white-space:normal;background-color:#E1E6E0;"> 参数解释: </p> <ol class=" list-paddingleft-2" style="margin:0px;padding:0px;border:0px;color:#2A2C29;font-family:'Microsoft Yahei';font-size:14px;line-height:25px;white-space:normal;background-color:#E1E6E0;"> <li style="margin:0px 0px 0px 2em;padding:0px;border:0px;list-style:decimal;"> <p style="margin-top:0px;margin-bottom:0px;padding:0px;border:0px;"> <strong style="margin:0px;padding:0px;border:0px;">a[target!=_blank]</strong><span style="margin:0px;padding:0px;border:0px;line-height:1.5;">:绑定本页面非新窗口打开的所有链接</span> </p> </li> <li style="margin:0px 0px 0px 2em;padding:0px;border:0px;list-style:decimal;"> <p style="margin-top:0px;margin-bottom:0px;padding:0px;border:0px;"> <strong style="margin:0px;padding:0px;border:0px;">#contentleft</strong><span style="margin:0px;padding:0px;border:0px;line-height:1.5;">:链接点击之后,仅仅更新#contentleft容器的内容,页面其他内容不变,需自行修改这个参数</span> </p> </li> <li style="margin:0px 0px 0px 2em;padding:0px;border:0px;list-style:decimal;"> <p style="margin-top:0px;margin-bottom:0px;padding:0px;border:0px;"> <strong style="margin:0px;padding:0px;border:0px;">fragment:'#contentleft'</strong><span style="margin:0px;padding:0px;border:0px;line-height:1.5;">:#contentleft选择器的碎片从Ajax响应提取</span> </p> </li> <li style="margin:0px 0px 0px 2em;padding:0px;border:0px;list-style:decimal;"> <p style="margin-top:0px;margin-bottom:0px;padding:0px;border:0px;"> <strong style="margin:0px;padding:0px;border:0px;">timeout:8000</strong><span style="margin:0px;padding:0px;border:0px;line-height:1.5;">:Ajax超时时间为8秒,如果未响应则直接刷新网页</span> </p> </li> </ol> <p style="margin-top:0px;margin-bottom:0px;padding:0px;border:0px;line-height:25px;color:#2A2C29;font-family:'Microsoft Yahei';font-size:14px;white-space:normal;background-color:#E1E6E0;"> <strong style="margin:0px;padding:0px;border:0px;">注意:这个 #contentleft 怎么找呢?</strong> </p> <p style="margin-top:0px;margin-bottom:0px;padding:0px;border:0px;line-height:25px;color:#2A2C29;font-family:'Microsoft Yahei';font-size:14px;white-space:normal;background-color:#E1E6E0;"> 小指的方法是打开模板的 echo_log.php,找到包裹文章页面的 div 的 id 就是了,一般是第一第二个 </p> <p style="margin-top:0px;margin-bottom:0px;padding:0px;border:0px;line-height:25px;color:#2A2C29;font-family:'Microsoft Yahei';font-size:14px;white-space:normal;background-color:#E1E6E0;"> id 名字都是 contentleft,content或者main之类的,按照这个方法一般都可以 </p> <p><br /> </div></p> 最后修改:1970 年 01 月 01 日 © 允许规范转载 打赏 赞赏作者 赞 如果觉得我的文章对你有用,请随意赞赏