我有以下列表,当用户单击一个li时,我希望ul.list隐藏然后显示div.single,同时将img.data-img src设置为li的data-img ,但是在加载时,我想将 img src 设置为 li 元素内的 loader.gif。
<ul class="list">
<li data-id="7" data-thumb="http://test.com/assets/pdc/thumbs/66.png" data-img="http://test.com/assets/pdc/img/66.png" data-country="Australia" data-company="Big Farm" data-app="Tea" data-brand="Big Farm" data-package="500" class="product air-500 cat7">
<img class="tip" data-country="Australia" data-brand="Big Farm" src="assets/img/ajax-loader.gif">
</li>
</ul>
<div class="single">
<img class="data-img" src="">
</div>
var preloader = $(this).find('.tip').attr('src');
$('.single aside img').attr('src', preloader);
$('.single aside img').attr('src', url).load(function () {
});