-
Notifications
You must be signed in to change notification settings - Fork 779
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Better bug fix #78 #80 #81
Conversation
Nice work! certainly reload is not the better. But a problem occurs when the $window.on('load.' + namespace, function() {
if(__.settings.timer) clearTimeout(__.settings.timer);
__.in.call(_this);
});
$window.on('pageshow.' + namespace, function() {
if(event.persisted) __.in.call(_this);
});
if(!options.onLoadEvent) $window.off('load.' + namespace); |
@blivesta here you go with your fix. Actually why not do this instead: if (options.onLoadEvent) {
$window.on('load.' + namespace, function() {
if(__.settings.timer) clearTimeout(__.settings.timer);
__.in.call(_this);
});
}
$window.on('pageshow.' + namespace, function() {
if(event.persisted) __.in.call(_this);
}); Why attach event handler and then remove it, why not check onloadevent property from the beginning? |
I don't remember, but your proposal is good. 'pageshow' event is also unnecessary in if(options.onLoadEvent) {
$window.on('load.' + namespace, function() {
if(__.settings.timer) clearTimeout(__.settings.timer);
__.in.call(_this);
});
}
$window.on('pageshow.' + namespace, function(event) {
// Safari back button issue #78 #80
if(event.originalEvent.persisted) __.in.call(_this);
});
//remove
//if(!options.onLoadEvent) $window.off('load.' + namespace);
addTimer: function(){
var _this = this;
var $this = $(this);
var options = $this.data(namespace).options;
__.settings.timer = setTimeout(function(){
__.in.call(_this);
$(window).off('load.' + namespace);
}, options.timeoutCountdown);
}, |
Thanks! |
I still have more thoughts for this. So more to come. :) On Friday, November 13, 2015, B L I V E S T A [email protected]
|
This in my opinion is 100 times better than fix in patch-4.0.1 as this does not trigger a window refresh. On example pages maybe it looks more or less good but in real web sites doing a page refresh on every history back button is pretty ugly, especially on iOS.
This does not work with custom elements like overlays however, maybe a better way would be to save somewhere all DOM modifications in
out
method and inin
method to revert them?As I understand it will work only for elements that have an
in
animation on the same elements that have anout
one, because this will trigger reverting classes.