Ajaxify 是一个 jQuery Ajax 插件,它能够通过跨页面用 Ajax 内容动态替换任何元素(例如页眉、侧边栏、页脚等)来对整个网站进行 ajax 化。
基本用法:
1.ajaxify.min.js加载 jQuery JavaScript 库后包含主 JavaScript 文件。
<script src="/path/to/cdn/jquery.min.js"></script>
<script src="ajaxify.min.js"></script>2. Ajax 化您的网站。这将动态地用 ID#content和  #nav跨页面替换 div 。
jQuery('#content, #nav').ajaxify();3. 配置插件的默认选项。
{
 
  // Selector for elements to ajaxify - without being swapped - e.g. a selection of links
  selector : "a:not(.no-ajaxy)", 
 
  // jQuery selection for ajaxifying forms - set to "false" to disable
  forms : "form:not(.no-ajaxy)",
 
  // Fetch current URL from "canonical" link if given, updating the History API.  In case of a re-direct...
  canonical : true,
 
  // Refresh the page if clicked link target current page
  refresh : false,
 
  // in msec - Delay of Pronto request
  requestDelay : 0,
 
  // in msec - must be set for animations to work
  aniTime : 0,
 
  // <a href="https://www.jqueryscript.net/animation/">Animation</a> parameters - see below.  Default = off
  aniParams : false,
 
  // Plugin previews prefetched pages - set to "false" to enable or provide a jQuery selection to selectively disable
  previewoff : true,
 
  // Smart scroll, true = always scroll to top of page, false = no scroll
  scrolltop : "s",
 
  // Copy body classes from target page, set to "true" to enable
  bodyClasses : false,
 
  // in msec - master switch for slideshow / carousel - default "off"
  idleTime: 0,
 
  // in msec - time between slides
  slideTime: 0,
 
  // For toggling sliding - see below.  Default = off
  toggleSlide: false
 
  // Selector for links in the menu
  menu: false,
 
  // Class that gets added dynamically to the highlighted element in the slideshow
  addclass: "jqhover",
 
  // true = deltas loaded, false = all scripts loaded
  deltas : true,
 
  // default async value for dynamically inserted external scripts, false = synchronous / true = asynchronous
  asyncdef : false,
 
  // strings, - separated by ", " - if matched in any external script URL - these are always loaded on every page load
  alwayshints: false,
 
  // true = all inline scripts loaded, false = only specific inline scripts are loaded
  inline : true,
 
  // strings - separated by ", " - if matched in any inline scripts - only these are executed - set "inline" to false beforehand
  inlinehints : false,
 
  // strings - separated by ", " - if matched in any inline scripts - these are NOT are executed - set "inline" to true beforehand
  inlineskip : "adsbygoogle",
 
  // append scripts to the main content div, instead of "eval"-ing them
  inlineappend : true,
 
  // true = all style tags in the head loaded, false = style tags on target page ignored
  style : true,
 
  // Plugin pre-fetches pages on hoverIntent - true = set off completely // strings - separated by ", " - hints to select out
  prefetchoff : false,
 
  // Debugging level to console: default off.  Can be set to 10 and higher (in case of logging enabled)
  verbosity : 0, 
 
  // strings - separated by ", " - if matched in any URLs - only these are NOT executed - set to "true" to disable memory completely
  memoryoff : false,
 
  // callback handler on completion of each Ajax request
  cb : null,
 
  // Plugin set "on" or "off" (==false) manually
  pluginon : true
   
}4.动画参数(aniParams):
{
 
  // no fade, set to 0 for maximum fade
  opacity: 1,
 
  // in percent -  "100%" means no change
  width: "100%",
 
  // in percent -  "100%" means no change
  height: "100%"
   
}5. 切换滑动参数(toggleSlide):
{
 
  // parent element, where the above images will be prepended
  parentEl: '#content',
 
  // graphic for indicating sliding is on
  imgOn: 'http://4nf.org/images/pinOn.gif',
 
  // graphic for indicating sliding is off
  imgOff: 'http://4nf.org/images/pinOff.gif',
 
  // title tag when on
  titleOn: 'Turn slideshow off',
 
  // title tag when off
  titleOff: 'Turn slideshow on',
 
  // image props
  imgProps: { marginLeft: '85%', marginTop: '20px' }
 
}变更日志:
2020-11-30
- v7.7.1:hoverIntent 解决方法和错误修复:内部深层链接 
2020-11-17
- v7.7.0:进入 ES6 - 与 pO() 完全解耦 
2020-06-24
- v7.6.4:修复 GA 计时/表单默认操作 
2020-06-01
- v7.6.3:修正 - tagName 处理 
2020-03-27
- v7.6.2:hoverIntent 修复;仅身体交换选项 
2020-03-23
- v7.6.1:更新 
2020-03-19
- v7.6.0:更新 
2020-03-09
- v7.5.6:使用箭头函数 
2020-02-20
- v7.5.5:开始使用箭头函数 
2020-01-21
- v7.5.4:修复了缩小 pO 函数中的记录错误 
2019-12-05
- v7.5.3:更新 
2019-11-17
- v7.5.2:更新 
2019-11-10
- v7.5.1:缩小规模。无功能变化 
2019-10-29
- v7.5.0:重新启用 touchstart 上的预取 
2019-10-28
- v7.4.6:Se地图调整 
2019-10-25
- v7.4.5:信号量调整 
2019-10-19
- v7.4.4:重新使用信号量 
2019-10-11
- v7.4.2:单击处理程序中的“链接”更改为“lnk” 
2019-09-02
- v7.4.1:修正:预取动态插入的链接 
2019-08-29
- v7.4.0:“提示”应用于 prefetchoff、previewoff 
2019-08-05
- v7.3.9:在 pronto.error 的情况下尽快访问 XHR 
2019-06-15
- v7.3.8: _copyAttributes() 重新应用,jQuery 选择验证 
2019-05-08
- v7.3.7:_copyAttributes() 不再应用于内容元素 
2019-04-24
- v7.3.6:修复了欺骗性错误 
2019-03-08
- v7.3.5:幻灯片已调试并可用 
2019-01-30
- v7.3.3:规范的默认值设置为 false 
2019-01-19
- v7.3.2:_searchHints() 应用于“memoryoff”处理 
2018-12-21
- v7.3.1:_copyAttributes() 重用于内容 div(s) 
2018-10-26
- v7.2.6:脚本处理变得透明 
2018-09-27
- v7.2.5:更新 
2018-06-09
- v7.2.1:bodyClasses 默认设置为“false” 
2018-03-02
- v7.2.0:Delta 加载简化,新参数“alwayshints” 
2018-02-27
- 修正了错字 
2018-01-29
- 获取“身体”时的错误已修复 
2018-01-14
- 支持外部JS脚本的“defer”属性 
2018-01-06
- 选项已更新 
 
                                         
                   
                 
            
 
                        

发表评论
◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。