我尝试将“{transform:'translateX(5px)'}”分配给变量(称为“aa”)。每次触发keydown函数时,为了添加运动的像素值。但它不会起作用。为什么?
我尝试过这样的事情:css()方法和offset()方法,它们都可以工作,但为什么使用这个animate()方法它不起作用?
<!DOCTYPE html>
<html>
<head>
<style>
div.divx {
width: 50px;
height: 50px;
background-color: black;
position: absolute;
left: 15px;
top: 15px;
z-index: -1;
}
</style>
</head>
<body>
<div class="divx"></div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script>
$(document).ready(function() {
var i = 0;
$(window).keydown(function(e) {
if (e.which == 39) { //39 is right button
i += 5;
a = i + 'px';
yy = 'translateX(' + a + ')';
xx = '"' + yy + '"';
aa = "{transform: " + xx + "}";
alert(aa);
$(".divx").animate(aa);
}
})
})
</script>
</body>
</html>
答案 0 :(得分:2)
functions.php
似乎是remove_action( 'woocommerce_after_shop_loop', 'woocommerce_pagination', 10 );
add_action( 'woocommerce_before_shop_loop', 'woocommerce_pagination', 10 );
function woocommerce_pagination(){
echo '<nav class="woocommerce-pagination">'; ?>
<?php
echo paginate_links( apply_filters( 'woocommerce_pagination_args', array(
'base' => str_replace( 999999999, '%#%', get_pagenum_link( 999999999 ) ),
'format' => '',
'current' => max( 1, get_query_var('paged') ),
'total' => $wp_query->max_num_pages,
'prev_text' => '←',
'next_text' => '→',
'type' => 'list',
'end_size' => 3,
'mid_size' => 3
) ) );
,aa
期待String
但它在警报上工作..
是的,提醒.animate()
。尝试使用Object
String
,将字符串传递给css
transition