正如标题所说:这行不通。该脚本确实移动了我想要移动的文章,如果我将选项放在选择器上,它也会对其进行动画处理,但它不会随机化元素的height
and 。width
所有元素的随机宽度为 127px,我无法理解。提取脚本的提到的 php 文件如下:
更新:
<script type="text/javascript" src="<? bloginfo('stylesheet_directory'); ?>/js/jquery.freetile.min.js"></script>
<script>
jQuery(document).ready(function() {
for (i=0;i<40;i++) {
var w = 128 * (parseInt(Math.random() * 3) + 1) - 1,h = 128 * (parseInt(Math.random() * 3) + 1) - 1;
jQuery('article').width(w).height(h);
}
jQuery('#content').freetile();
selector: 'article';
animate: true;
elementDelay: 10
});
</script>
这部分有什么问题吗?那会很奇怪,因为我从 github 存储库中复制并粘贴了它。
for (i=0;i<40;i++) {
var w = 128 * (parseInt(Math.random() * 3) + 1) - 1,h = 128 * (parseInt(Math.random() * 3) + 1) - 1;
jQuery('article').width(w).height(h);
}
这是文件的链接: https ://github.com/yconst/Freetile/blob/master/js/init.js
谢谢ComputerArts,我已经接受了你的回答:)