0
我有这样的波及效应代码:位置HREF收益为未定义
(function (window, $) {
$(function() {
$('.ripple-white').on('click', function (event) {
event.preventDefault();
var $div = $('<div/>'),
btnOffset = $(this).offset(),
xPos = event.pageX - btnOffset.left,
yPos = event.pageY - btnOffset.top;
$div.addClass('ripple-effect');
var $ripple = $(".ripple-effect");
$ripple.css("height", $(this).height());
$ripple.css("width", $(this).height());
$div
.css({
top: yPos - ($ripple.height()/2),
left: xPos - ($ripple.width()/2),
background: $(this).data("ripple-color")
})
.appendTo($(this));
window.setTimeout(function(){
$div.remove();
location.href = $(this).attr('href');
}, 800);
});
});
})(window, jQuery);
这是动态使用WordPress的上市后:
<?php $the_query = new WP_Query('posts_per_page=50'); ?>
<?php while ($the_query -> have_posts()) : $the_query -> the_post(); ?>
<div class="flex-3col"><a class="ripple-white" href="<?php the_permalink() ?>"><h3 class="single-menu"><?php the_title(); ?></h3></a></div>
<?php endwhile; wp_reset_postdata(); ?>
出于某种原因,我越来越放在location.href为未定义。我也试过:
$('a', this).attr("href");
任何意见我在做什么错在这里?