我正在使用Turbolinks,我有一个在页面之间发生的加载动画.我目前正在使用page:load来完成动画,但是看起来好像page:load就像文件就绪而不是window.on加载.
期望的效果是我在页面加载时在页面上显示加载动画时显示的叠加层.一旦页面完全加载(包含图像,对象等),它将淡出叠加层以显示内容.
发生的事情是在页面完全加载之前显示内容.这是我正在使用的JavaScript.
(function () {
function showPreloader() {
Turbolinks.enableProgressBar();
$('#status').fadeIn('slow');
$('#preloader').delay(300).fadeIn('slow');
}
function hidePreloader() {
$('#status').fadeOut();
$('#preloader').delay(300).fadeOut('slow');
}
$(document).on('page:fetch', showPreloader);
$(document).on('page:load', hidePreloader);
$(window).on('load', hidePreloader);
})()
Run Code Online (Sandbox Code Playgroud) 我如何解雇超过主要内容的UIView?可以将其视为带有关闭按钮的巡视弹出窗口.这是我正在使用的代码,但它不起作用.没有错误或警告,似乎没有做到这一点.有任何想法吗?
- (void) showUserSettings {
UIView *settingsPopover = [[UIView alloc] init];
settingsPopover.frame = CGRectMake(20, 600, 280, 350);
[settingsPopover.layer setBackgroundColor:[UIColor colorWithRed:(241/255.0) green:(241/255.0) blue:(241/255.0) alpha:1].CGColor];
[UIView animateWithDuration:0.35 animations:^{
settingsPopover.frame = CGRectMake(20, 130, 280, 350);
settingsPopover.alpha = 1.0f;
} completion:^(BOOL finished) {
}];
UIButton *closeSettings = [[UIButton alloc] initWithFrame:CGRectMake(245, 0, 35, 40)];
[closeSettings setBackgroundColor:[UIColor colorWithRed:(212/255.0) green:(121/255.0) blue:(146/255.0) alpha:1]];
[closeSettings setTitle:@"X" forState:UIControlStateNormal];
[closeSettings addTarget:self action:@selector(closeSettings) forControlEvents:UIControlEventTouchUpInside];
[settingsPopover addSubview:closeSettings];
[self.view addSubview:settingsPopover];
}
- (void) closeSettings {
[UIView animateWithDuration:0.35 animations:^{
_settingsPopover.frame = CGRectMake(20, 400, 280, 350); …Run Code Online (Sandbox Code Playgroud)