attr()不参与移动游猎

时间:2012-12-18 23:17:39

标签: attr

对jquery来说很新...我想弄清楚为什么在移动游猎中我的attr()不能正常工作:

$(document).ready(function(e) {

var i= 0;
var winHeight= $(window).resize().height();

var iDivs= ['bgImage5','bgImage4','bgImage3','bgImage2','bgImage1'];
var currentPhoto= iDivs[i];

    $('div.bgImage').attr({id:currentPhoto})
    $('#bioBody').hide();
    $('#bio').click(function(){
    $('#bioBody').slideToggle('slow')
    });
<div id="imgContainer">
    <div></div>
    <div class="bgImage"></div>
    <div></div>

1 个答案:

答案 0 :(得分:0)

我认为它应该是$('.bgImage').attr('id', 'currentPhoto');