我正在尝试创建一个支持 WebP 的图片标签。
(如果屏幕尺寸超过 1024px,则加载 image-full,最大宽度为 1024px 时加载 image-1024,最大宽度为 768px 时加载 image-768,最大宽度为 500px 时加载 image-500)
我有这段代码,w3 验证器抱怨:当 srcset 属性具有任何带有宽度描述符的图像候选字符串时,尺寸属性也必须存在。
我如何在其中实现尺寸?我应该有更好/不同的方法吗?
<picture>
// load webp in different sizes if browser supports it
<source media="(min-width: 1025px)"
srcset="webp/image-full.webp"
type="image/webp">
<source media="(max-width: 1024px)"
srcset="webp/image-1024.webp"
type="image/webp">
<source media="(max-width: 768px)"
srcset="webp/image-768.webp"
type="image/webp">
<source media="(max-width: 500px)"
srcset="webp/image-500.webp"
type="image/webp">
// load jpg in different sizes if browser doesn't support webp
<source media="(min-width: 1025px)"
srcset="siteimages/image-full.jpg"
type="image/jpeg">
<source media="(max-width: 1024px)"
srcset="siteimages/image-1024.jpg"
type="image/jpeg">
<source media="(max-width: 768px)"
srcset="siteimages/image-768.jpg"
type="image/jpeg">
<source media="(max-width: 500px)" …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用以下脚本将带有一堆子文件夹的大型 Dropbox 文件夹下载到外部硬盘驱动器:http : //tilburgsciencehub.com/examples/dropbox/
import dropbox
from get_dropbox import get_folders, get_files
from dropbox.exceptions import ApiError, AuthError
# read access token
access_token = "sl.superlongstring"
print('Authenticating with Dropbox...')
try:
dbx = dropbox.Dropbox(access_token, scope=['files.content.read', 'files.metadata.read'])
print('...authenticated with Dropbox owned by ' + dbx.users_get_current_account().name.display_name)
except AuthError as err:
print(err)
Run Code Online (Sandbox Code Playgroud)
这里没有错误,正确显示我的名字。
try:
folders=get_folders(dbx, '/Audioboeken')
print(folders)
download_dir = r'L:\\00 Audioboeken'
print('Obtaining list of files in target directory...')
get_files(dbx, folder_id, download_dir)
except ApiError as err:
print(err)
except AuthError as autherr:
print(autherr)
Run Code Online (Sandbox Code Playgroud)
这个错误:
dropbox.exceptions.AuthError: AuthError('randomstringofnumbers, AuthError('missing_scope', …
我可能盯着它看了太长时间,并且缺少明显的东西,但是:为什么在JSFiddle中可以正常工作,而在上载时却不能正常工作?
最后的警报显示在测试网站上,但是无论如何也可以看到“ showthis”。
的HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Test Form Field</title>
<script type="text/javascript" src="scripts/jquery-1.11.0.min.js"></script>
<script type="text/javascript" src="scripts/showfield.js"></script>
</head>
<body>
<input type="checkbox" name="checkbox" id="checkbox" value="checkbox" />
<br />
<input id="showthis" name="showthis" size="50" type="text" value="text here"/>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
jQuery(我下载了一个缩小的jQuery 1.11.0,这在JSFiddle中是有效的)
//hide field by default
$('input[name="showthis"]').hide();
//show it when the checkbox is clicked
$('input[name="checkbox"]').on('click', function(){
if ( $(this).prop('checked') ) {
$('input[name="showthis"]').fadeIn();
}
else {
$('input[name="showthis"]').hide();
}
});
// the alert is …Run Code Online (Sandbox Code Playgroud)