Я использую SmoothState.Js для загрузки новых страниц на кликах. Поскольку на каждой из этих страниц логотип остается в одном месте/размере, я бы хотел, чтобы логотип не обновлялся и не исчезал на странице.SmoothStateJS: как сохранить элемент от обновления на смену страницы?
Ссылки в моем меню не обновляются, но логотип делает. Я ничего не видел в документах или в Google, рассматривающих это. Как я могу постоянно сохранять изображение на месте между этими изменениями в ajax?
Вот SmoothState вызов:
$(function() {
$('#main').smoothState();
});
$(function() {
"use strict";
var options = {
prefetch: true,
pageCacheSize: 4,
onStart: {
duration: 300, // Duration of our animation
render: function($container) {
// Add your CSS animation reversing class
$container.addClass("is-exiting");
// Restart your animation
smoothState.restartCSSAnimations();
}
},
onReady: {
duration: 0,
render: function($container, $newContent) {
// Remove your CSS animation reversing class
$container.removeClass("is-exiting");
// Inject the new content
$container.html($newContent);
}
},
},
smoothState = $("#main").smoothState(options).data("smoothState");
});
HTML-:
<header class="header">
<div class="main-logo">
<a class="svg" href="www.site.com">
<object class="willItBlend" data="../svg/main-logo.svg" type="image/svg+xml"></object>
<img class="blender" src="../svg/main-logo.png" />
</a>
</div>
<nav class="main-nav-about">
// links go here
</nav>
</header>
Доступно событие требует SmoothState:
onBefore - Runs before a page load has been started
onStart - Runs once a page load has been activated
onProgress - Runs if the page request is still pending and the onStart animations have finished
onReady - Run once the requested content is ready to be injected into the page and the previous animations have finished
onAfter - Runs after the new content has been injected into the page and all animations are complete