Jquery History.js+;形式?
我们正在从迁移到。Ajaxy拥有智能表单管理。有人知道如何将History.js集成到表单处理中吗?History.js本质上是一个跨浏览器的垫片,允许您使用HTML5历史API,它没有专门提供任何内置表单管理逻辑。因此,如果要使用它来管理表单状态,必须手动将历史记录条目添加到浏览器历史记录对象,如下所示:Jquery History.js+;形式?,jquery,ajax,history.js,Jquery,Ajax,History.js,我们正在从迁移到。Ajaxy拥有智能表单管理。有人知道如何将History.js集成到表单处理中吗?History.js本质上是一个跨浏览器的垫片,允许您使用HTML5历史API,它没有专门提供任何内置表单管理逻辑。因此,如果要使用它来管理表单状态,必须手动将历史记录条目添加到浏览器历史记录对象,如下所示: // If the History.js plugin has been included on the page if(window.History) { // Adds a n
// If the History.js plugin has been included on the page
if(window.History) {
// Adds a new state and url to the browser history object
// Eg. If your page was index.html... it becomes index.html?someState
window.History.pushState(null, $(this).attr("data-href"), "?someState");
}
// If the History.js plugin has been included on the page
if(window.History) {
// Binds to the StateChange Event
window.History.Adapter.bind(window,'statechange',function() {
// Do something
});
}
如果您有一些在发生状态更改时需要执行的自定义逻辑,您可以执行以下操作:
// If the History.js plugin has been included on the page
if(window.History) {
// Adds a new state and url to the browser history object
// Eg. If your page was index.html... it becomes index.html?someState
window.History.pushState(null, $(this).attr("data-href"), "?someState");
}
// If the History.js plugin has been included on the page
if(window.History) {
// Binds to the StateChange Event
window.History.Adapter.bind(window,'statechange',function() {
// Do something
});
}
有关History.js的更多信息,请查看您是否找到了有关如何使用表单以及如何使用History.js发布操作的信息?请回复。