如果你查看东芝的网站,那里有一个带有移动箭头的小鼠标图标.显然,他们是这样的动画:
function iconTop() {
$(".icon_tween").animate({
opacity: 0,
marginTop: "15px"
}, 1e3, function () {
$(".icon_tween").css({
marginTop: 0,
opacity: 1
}), iconTop()
})
}
Run Code Online (Sandbox Code Playgroud)
..是否可以仅使用CSS完全相同的动画?
我需要根据某些条件调整和隐藏元素的大小,但我无法做到。
伪代码:
If height is less than or equal to 400px : hide
If height is between 401-600 : do x
If height is greater than or equal to 601px : do y
Run Code Online (Sandbox Code Playgroud)
我这样做:
@media only screen and (max-height: 400px) {
/* hide */
}
@media only screen and (min-height: 401px) and (max-height: 600px) {
/* do X */
}
@media only screen and (max-height: 601px) {
/* do Y */
}
Run Code Online (Sandbox Code Playgroud)
...但它总是默认为最后一个条件: do Y
Amazon API返回奇怪的维度.在网站上,他们显示:
Product Dimensions: 8.7 x 7.9 x 0.6 inches ; 1.8 ounces
Shipping Weight: 4 ounces
Run Code Online (Sandbox Code Playgroud)
当API返回时:
[ItemDimensions] => Array
(
[Height] => 59
[Length] => 866
[Weight] => 11
[Width] => 787
)
[PackageDimensions] => Array
(
[Height] => 50
[Length] => 700
[Weight] => 25
[Width] => 200
)
Run Code Online (Sandbox Code Playgroud)
我不确定那个单位是什么.我确认了两次,以确保它是相同的产品.
我需要将它转换为mm和grams.22cm or 220mm is 8.7 inches所以没有任何线索50或那些59被退回.重量相同.
我正在将两个脚本加载到我的结帐页面:
function wpb_adding_scripts() {
if ( function_exists( 'is_woocommerce' ) ) {
if ( is_woocommerce() && is_checkout() ) {
wp_register_script('google-maps-api', 'https://maps.googleapis.com/maps/api/js?key=[iprovidemykeyhere]&callback=initMap');
wp_register_script('location_tracker', get_stylesheet_directory_uri() . '/js/track_location.js', array('google-maps-api'));
wp_enqueue_script('google-maps-api');
wp_enqueue_script('location_tracker');
}
}
}
add_action( 'wp_enqueue_scripts', 'wpb_adding_scripts', 999 );
Run Code Online (Sandbox Code Playgroud)
...但是我正确地在上面的URL中提供了密钥,但得到了以下信息:
Google Maps API警告:NoApiKeys https://developers.google.com/maps/documentation/javascript/error-messages#no-api-keys
Google Maps API警告:SensorNotRequired https://developers.google.com/maps/documentation/javascript/error-messages#sensor-not-required
代码:
try {
$documentsFind = $client->$db->$collection->find([
// query
]);
if ($documentsFind) {
foreach ($documentsFind as $product) {
// code...
}
}
catch (MongoCursorException $e) {
echo "error message: ".$e->getMessage()."\n";
echo "error code: ".$e->getCode()."\n";
}
Run Code Online (Sandbox Code Playgroud)
错误:
致命错误:未捕获的MongoDB \ Driver \ Exception \ RuntimeException:未找到游标,游标ID:31837896248 ...
似乎光标确实存在但超时了?如何防止这种情况发生?
编辑添加:我尝试做:
if ($documentsFind) {
$documentsFind->immortal(true); // keep alive
foreach ($documentsFind as $product) {
// code...
}
}
Run Code Online (Sandbox Code Playgroud)
但这导致了Call to undefined method MongoDB\Driver\Cursor::immortal()。
我正在使用Goutte(它使用Guzzle)来提取内容,尽管我在 try/catch 中运行,但我的脚本以错误结束:
Error: Client error: `GET http://example.com/C42C9CA3` resulted in a `403 Forbidden` response:
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"htt (truncated...)
Run Code Online (Sandbox Code Playgroud)
这就是我所拥有的:
use Goutte\Client;
$HTTPconfig = [ "curl" => [
CURLOPT_TIMEOUT => 60,
CURLOPT_CONNECTTIMEOUT => 60,
CURLOPT_SSL_VERIFYPEER => false,
],
['http_errors' => false]
];
$HTTPclient = new \Goutte\Client;
$HTTPclient->setClient(new \GuzzleHttp\Client($HTTPconfig));
$HTTPclient->setHeader('user-agent', 'Mozilla/5.0 (Windows NT 6.2; rv:20.0) Gecko/20121202 Firefox/20.0');
try {
$crawler = $HTTPclient->request('GET', $url);
$doc = $crawler->html();
} catch (Exception $e) …Run Code Online (Sandbox Code Playgroud) <div class="field">
<label>Label</label>
<input type="text" name="" value="">
</div>
<div class="field">
<input type="text" name="" value="">
</div>
Run Code Online (Sandbox Code Playgroud)
有没有什么办法可以根据标签有条件地设置输入宽度.如果标签存在:
.field label {
width:25%;
}
.field input {
width:75%;
}
Run Code Online (Sandbox Code Playgroud)
其他:
.field input {
width:100%;
}
Run Code Online (Sandbox Code Playgroud)
我可以用javascript做到这一点,但想知道它是否只能用CSS.
我安装了nvm,它在我的 中插入了一些行.profile,我修改它们以使用 Fish shell 而不是 bash:
if [ "$BASH" ]
if [ -f ~/.bashrc ]
. ~/.bashrc
end
end
mesg n or true
export NVM_DIR="/root/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] and . "$NVM_DIR/nvm.sh" # This loads nvm
Run Code Online (Sandbox Code Playgroud)
..但我仍然收到此错误:
root@server011 ~# source /root/.profile
[: the last argument must be ']'
Run Code Online (Sandbox Code Playgroud) ul,li {
display: block;
margin:0;
padding:0;
list-style:none;
}
li {
background: black;
color: white;
padding: 10px;
}
li:nth-child(2n+2) {
background: red;
}
li:nth-child(3n+3) {
background: green;
}
li:nth-child(4n+4) {
background: blue;
}Run Code Online (Sandbox Code Playgroud)
<ul>
<li>one</li>
<li>two</li>
<li>three</li>
<li>four</li>
<li>five</li>
<li>six</li>
<li>seven</li>
<li>eight</li>
<li>nine</li>
<li>ten</li>
<li>eleven</li>
<li>twelve</li>
</ul>Run Code Online (Sandbox Code Playgroud)
我需要什么:
......我怎么做到这一点:nth-child?
$arr1 = [1,2,3];
$arr2 = [1,2,3,4];
$arr3 = [1,2,3,4,5];
echo max( count($arr1), count($arr2), count($arr3) ); // returns 5
Run Code Online (Sandbox Code Playgroud)
与max我得到的计数,但不知道哪个数组较大.如何获得更大的数组引用($arr3在本例中)?