Доб предмет "Фон" вставляю в код,например в конце дописываю новый фон
['bg1','Майами',0,0],
Но при покупке в приложении,фон не меняется,и потом опять покупать нужно,место установить.в чем проблема?
function toshop() {
$('#panel_top').css({'display':'none'});
$('#top').css({'display':'none'});
$('#panel_shop').css({'display':'block'});
$('#shop').css({'display':'block'});
showfones(0);
}
function totop() {
$('#panel_top').css({'display':'block'});
$('#top').css({'display':'block'});
$('#panel_shop').css({'display':'none'});
$('#shop').css({'display':'none'});
}
// ФОНЫ
// ФОНЫ
// ФОНЫ
function showfones(offset) {
$('#fones_but').css({'background':'url(img/buy_act.png) center center no-repeat'});
$('#trees_but').css({'background':'url(img/buy_noact.png) center center no-repeat'});
$('#limbs_but').css({'background':'url(img/buy_noact.png) center center no-repeat'});
$('#animals_but').css({'background':'url(img/buy_noact.png) center center no-repeat'});
$('#girls_but').css({'background':'url(img/buy_noact.png) center center no-repeat'});
var fones = [ ['bg1','Майами',0,0],
['bg2','Дикий пляж',0,150],
['bg3','Ямайка',1,2],
['bg4','Вулканный',1,35],
['bg5','Сказочный',1,50],
['bg6','Безмятежность',0,1500],
['bg11','Ямай',0,350]
];
if(offset > fones.length-5) offset = fones.length-5;
if(offset<0) offset = 0;
$('#shop').html('');
var ok = '<a href="javascript:showfones('+(offset-1)+');"><div id="shop_left"></div></a>';
for(var i=offset;i<offset+5;i++) {
if(fones.length-1 < i) break;
if(fones[i][2] == 0) var img = 'buy_drops_mini.png';
else var img = 'buy_sheet_mini.png';
var est = false;
for(var x=0;x<buyed_items[0].length;x++) {
if(buyed_items[0][x] == i) est = true;
}
if(!est) {
ok += '<div class="shop_item" onmouseover="displayfon(\'img2/'+fones[i][0]+'_big.jpg\');" onmouseout="displayfonend();">' +
'<div class="shop_item_name">'+fones[i][1]+'</div>' +
'<div class="shop_item_image"><img src="img2/'+fones[i][0]+'.png"></div>' +
'<a href="javascript:buyitem(1,'+i+');">' +
'<div class="shop_item_buy">' +
'<div class="shop_item_buy_text">' +
'<span class="shop_item_buy_price">купить за '+fones[i][3]+'</span><img src="img/'+img+'">' +
'</div></div></a></div>';
}
else {
ok += '<div class="shop_item" onmouseover="displayfon(\'img2/'+fones[i][0]+'_big.jpg\');" onmouseout="displayfonend();">' +
'<div class="shop_item_name">'+fones[i][1]+'</div>' +
'<div class="shop_item_image"><img src="img2/'+fones[i][0]+'.png"></div>' +
'<a href="javascript:setitem(1,'+i+');">' +
'<div class="shop_item_buy">' +
'<div class="shop_item_buy_text">' +
'<span class="shop_item_buy_price">установить</span>' +
'</div></div></a></div>';
}
}
ok += '<a href="javascript:showfones('+(offset+1)+');"><div id="shop_right"></div></a><a href="javascript:totop();"><div id="shop_exit"></div></a>';
$('#shop').html(ok);
lastget = 0;
}
function displayfon(src) {
endfon = $('#bg').css('background');
$('#bg').css({'background':'url('+src+') center 62px no-repeat'});
}
function displayfonend() {
$('#bg').css({'background':endfon});
}
// ДЕРЕВЬЯ
// ДЕРЕВЬЯ
// ДЕРЕВЬЯ
function showtrees(offset) {
$('#fones_but').css({'background':'url(img/buy_noact.png) center center no-repeat'});
$('#trees_but').css({'background':'url(img/buy_act.png) center center no-repeat'});
$('#limbs_but').css({'background':'url(img/buy_noact.png) center center no-repeat'});
$('#animals_but').css({'background':'url(img/buy_noact.png) center center no-repeat'});
$('#girls_but').css({'background':'url(img/buy_noact.png) center center no-repeat'});
var trees = [ ['tree1','Обыкновенная',0,0],
['tree2','Кокосовая',0,150],
['tree3','Майамская',0,120],
['tree4','Симпл-пальма',0,150],
['tree5','Листовая',1,30],
['tree6','"Зеленка"',1,40],
['tree7','"Пушистик"',1,50],
['tree8','"Худая"',0,200],
['tree9','"Двупалая"',1,100],
['tree10','Кокос',0,100]
];
if(offset > trees.length-5) offset = trees.length-5;
if(offset<0) offset = 0;
$('#shop').html('');
var ok = '<a href="javascript:showtrees('+(offset-1)+');"><div id="shop_left"></div></a>';
for(var i=offset;i<offset+5;i++) {
if(trees.length-1 < i) break;
if(trees[i][2] == 0) var img = 'buy_drops_mini.png';
else var img = 'buy_sheet_mini.png';
var est = false;
for(var x=0;x<buyed_items[1].length;x++) {
if(buyed_items[1][x] == i) est = true;
}
if(!est) {
ok += '<div class="shop_item" onmouseover="displaytree(\'img2/'+trees[i][0]+'_big.png\');" onmouseout="displaytreeend();">' +
'<div class="shop_item_name">'+trees[i][1]+'</div>' +
'<div class="shop_item_image"><img src="img2/'+trees[i][0]+'.png"></div>' +
'<a href="javascript:buyitem(2,'+i+');">' +
'<div class="shop_item_buy">' +
'<div class="shop_item_buy_text">' +
'<span class="shop_item_buy_price">купить за '+trees[i][3]+'</span><img src="img/'+img+'">' +
'</div></div></a></div>';
}
else {
ok += '<div class="shop_item" onmouseover="displaytree(\'img2/'+trees[i][0]+'_big.png\');" onmouseout="displaytreeend();">' +
'<div class="shop_item_name">'+trees[i][1]+'</div>' +
'<div class="shop_item_image"><img src="img2/'+trees[i][0]+'.png"></div>' +
'<a href="javascript:setitem(2,'+i+');">' +
'<div class="shop_item_buy">' +
'<div class="shop_item_buy_text">' +
'<span class="shop_item_buy_price">установить</span>' +
'</div></div></a></div>';
}
}
ok += '<a href="javascript:showtrees('+(offset+1)+');"><div id="shop_right"></div></a><a href="javascript:totop();"><div id="shop_exit"></div></a>';
$('#shop').html(ok);
lastget = 1;
}
function displaytree(src) {
endtree = $('#tree_img img').attr('src');
$('#tree_img img').attr('src',src);
}
function displaytreeend() {
$('#tree_img img').attr('src',endtree);
}
// УКРАШЕНИЯ
// УКРАШЕНИЯ
// УКРАШЕНИЯ
function showlimbs(offset) {
$('#fones_but').css({'background':'url(img/buy_noact.png) center center no-repeat'});
$('#trees_but').css({'background':'url(img/buy_noact.png) center center no-repeat'});
$('#limbs_but').css({'background':'url(img/buy_act.png) center center no-repeat'});
$('#animals_but').css({'background':'url(img/buy_noact.png) center center no-repeat'});
$('#girls_but').css({'background':'url(img/buy_noact.png) center center no-repeat'});
var limbs = [ ['limb1','"Европейское"',0,30],
['limb2','Пальмовое',0,250],
['limb3','"Редкое"',1,60]
];
if(offset > limbs.length-5) offset = limbs.length-5;
if(offset<0) offset = 0;
$('#shop').html('');
var ok = '<a href="javascript:showlimbs('+(offset-1)+');"><div id="shop_left"></div></a>';
for(var i=offset;i<offset+5;i++) {
if(limbs.length-1 < i) break;
if(limbs[i][2] == 0) var img = 'buy_drops_mini.png';
else var img = 'buy_sheet_mini.png';
var est = false;
for(var x=0;x<buyed_items[2].length;x++) {
if(buyed_items[2][x] == i) est = true;
}
if(!est) {
ok += '<div class="shop_item" onmouseover="displaylimb(\'img2/'+limbs[i][0]+'_big.png\');" onmouseout="displaylimbend();">' +
'<div class="shop_item_name">'+limbs[i][1]+'</div>' +
'<div class="shop_item_image"><img src="img2/'+limbs[i][0]+'.png"></div>' +
'<a href="javascript:buyitem(3,'+i+');">' +
'<div class="shop_item_buy">' +
'<div class="shop_item_buy_text">' +
'<span class="shop_item_buy_price">купить за '+limbs[i][3]+'</span><img src="img/'+img+'">' +
'</div></div></a></div>';
}
else {
ok += '<div class="shop_item" onmouseover="displaylimb(\'img2/'+limbs[i][0]+'_big.png\');" onmouseout="displaylimbend();">' +
'<div class="shop_item_name">'+limbs[i][1]+'</div>' +
'<div class="shop_item_image"><img src="img2/'+limbs[i][0]+'.png"></div>' +
'<a href="javascript:setitem(3,'+i+');">' +
'<div class="shop_item_buy">' +
'<div class="shop_item_buy_text">' +
'<span class="shop_item_buy_price">установить</span>' +
'</div></div></a></div>';
}
}
ok += '<a href="javascript:showlimbs('+(offset+1)+');"><div id="shop_right"></div></a><a href="javascript:totop();"><div id="shop_exit"></div></a>';
$('#shop').html(ok);
lastget = 2;
}
function displaylimb(src) {
endlimbs = $('#limbs').css('background');
$('#limbs').css({'background':'url('+src+') center center no-repeat'});
}
function displaylimbend() {
$('#limbs').css({'background':endlimbs});
}
// ПТИЦЫ
// ПТИЦЫ
// ПТИЦЫ
function showanimals(offset) {
$('#fones_but').css({'background':'url(img/buy_noact.png) center center no-repeat'});
$('#trees_but').css({'background':'url(img/buy_noact.png) center center no-repeat'});
$('#limbs_but').css({'background':'url(img/buy_noact.png) center center no-repeat'});
$('#animals_but').css({'background':'url(img/buy_act.png) center center no-repeat'});
$('#girls_but').css({'background':'url(img/buy_noact.png) center center no-repeat'});
var animals =[ ['animal1','Зеленый',0,35],
['animal2','Обыкновенный',0,300],
['animal3','Желтоговый',1,120]
];
if(offset > animals.length-5) offset = animals.length-5;
if(offset<0) offset = 0;
$('#shop').html('');
var ok = '<a href="javascript:showanimals('+(offset-1)+');"><div id="shop_left"></div></a>';
for(var i=offset;i<offset+5;i++) {
if(animals.length-1 < i) break;
if(animals[i][2] == 0) var img = 'buy_drops_mini.png';
else var img = 'buy_sheet_mini.png';
var est = false;
for(var x=0;x<buyed_items[3].length;x++) {
if(buyed_items[3][x] == i) est = true;
}
if(!est) {
ok += '<div class="shop_item" onmouseover="displayanimal(\'img2/'+animals[i][0]+'_big.png\');" onmouseout="displayanimalend();">' +
'<div class="shop_item_name">'+animals[i][1]+'</div>' +
'<div class="shop_item_image"><img src="img2/'+animals[i][0]+'.png"></div>' +
'<a href="javascript:buyitem(4,'+i+');">' +
'<div class="shop_item_buy">' +
'<div class="shop_item_buy_text">' +
'<span class="shop_item_buy_price">купить за '+animals[i][3]+'</span><img src="img/'+img+'">' +
'</div></div></a></div>';
}
else {
ok += '<div class="shop_item" onmouseover="displayanimal(\'img2/'+animals[i][0]+'_big.png\');" onmouseout="displayanimalend();">' +
'<div class="shop_item_name">'+animals[i][1]+'</div>' +
'<div class="shop_item_image"><img src="img2/'+animals[i][0]+'.png"></div>' +
'<a href="javascript:setitem(4,'+i+');">' +
'<div class="shop_item_buy">' +
'<div class="shop_item_buy_text">' +
'<span class="shop_item_buy_price">установить</span>' +
'</div></div></a></div>';
}
}
ok += '<a href="javascript:showanimals('+(offset+1)+');"><div id="shop_right"></div></a><a href="javascript:totop();"><div id="shop_exit"></div></a>';
$('#shop').html(ok);
lastget = 3;
}
function displayanimal(src) {
endanimal = $('#animal').css('background');
$('#animal').css({'background':'url('+src+') center center no-repeat'});
}
function displayanimalend() {
$('#animal').css({'background':endanimal});
}
// ДЕВУШКИ
// ДЕВУШКИ
// ДЕВУШКИ
function showgirls(offset) {
$('#fones_but').css({'background':'url(img/buy_noact.png) center center no-repeat'});
$('#trees_but').css({'background':'url(img/buy_noact.png) center center no-repeat'});
$('#limbs_but').css({'background':'url(img/buy_noact.png) center center no-repeat'});
$('#animals_but').css({'background':'url(img/buy_noact.png) center center no-repeat'});
$('#girls_but').css({'background':'url(img/buy_act.png) center center no-repeat'});
var girls = [ ['girl1','"Jennifer"',0,35],
['girl2','"Loreen"',1,100],
['girl3','"Аи"',1,15],
['girl4','"Анна"',0,600]
];
if(offset > girls.length-5) offset = girls.length-5;
if(offset<0) offset = 0;
$('#shop').html('');
var ok = '<a href="javascript:showgirls('+(offset-1)+');"><div id="shop_left"></div></a>';
for(var i=offset;i<offset+5;i++) {
if(girls.length-1 < i) break;
if(girls[i][2] == 0) var img = 'buy_drops_mini.png';
else var img = 'buy_sheet_mini.png';
var est = false;
for(var x=0;x<buyed_items[4].length;x++) {
if(buyed_items[4][x] == i) est = true;
}
if(!est) {
ok += '<div class="shop_item" onmouseover="displaygirl(\'img2/'+girls[i][0]+'_big.png\');" onmouseout="displaygirlend();">' +
'<div class="shop_item_name">'+girls[i][1]+'</div>' +
'<div class="shop_item_image"><img src="img2/'+girls[i][0]+'.png"></div>' +
'<a href="javascript:buyitem(5,'+i+');">' +
'<div class="shop_item_buy">' +
'<div class="shop_item_buy_text">' +
'<span class="shop_item_buy_price">купить за '+girls[i][3]+'</span><img src="img/'+img+'">' +
'</div></div></a></div>';
}
else {
ok += '<div class="shop_item" onmouseover="displaygirl(\'img2/'+girls[i][0]+'_big.png\');" onmouseout="displaygirlend();">' +
'<div class="shop_item_name">'+girls[i][1]+'</div>' +
'<div class="shop_item_image"><img src="img2/'+girls[i][0]+'.png"></div>' +
'<a href="javascript:setitem(5,'+i+');">' +
'<div class="shop_item_buy">' +
'<div class="shop_item_buy_text">' +
'<span class="shop_item_buy_price">установить</span>' +
'</div></div></a></div>';
}
}
ok += '<a href="javascript:showgirls('+(offset+1)+');"><div id="shop_right"></div></a><a href="javascript:totop();"><div id="shop_exit"></div></a>';
$('#shop').html(ok);
lastget = 4;
}
function displaygirl(src) {
endgirls = $('#girl').css('background');
$('#girl').css({'background':'url('+src+') center center no-repeat'});
}
function displaygirlend() {
$('#girl').css({'background':endgirls});
}
// ПОКУПКА
// ПОКУПКА
// ПОКУПКА
function buyitem(type,id) {
var items =[ [ ['bg1','Майавыа',0,0],
['bg2','Дикий пляж',0,150],
['bg3','Ямайка',1,2],
['bg4','Вулканный',1,35],
['bg5','Сказочный',1,50],
['bg6','Безмятежность',0,2100],
['bg11','Ямай',2,350]
],
[ ['tree1','Обыкновенная',0,0],
['tree2','Кокосовая',0,150],
['tree3','Майамская',0,120],
['tree4','Симпл-пальма',0,150],
['tree5','Листовая',1,30],
['tree6','"Зеленка"',1,40],
['tree7','"Пушистик"',1,50],
['tree8','"Худая"',0,200],
['tree9','"Двупалая"',1,100],
['tree10','Кокос',0,100]
],
[ ['limb1','"Европейское"',0,30],
['limb2','Пальмовое',0,250],
['limb3','"Редкое"',1,60]
],
[ ['animal1','Зеленый',0,35],
['animal2','Обыкновенный',0,300],
['animal3','Желтоговый',1,120]
],
[ ['girl1','"Jennifer"',0,35],
['girl2','"Loreen"',1,100],
['girl3','"Аи"',1,15],
['girl4','"Анна"',0,600]
]
];
if(items[type-1][id][2] == 0) var img = 'buy_drops_mini.png';
else var img = 'buy_sheet_mini.png';
$('#if_shop_text img').attr('src','img/'+img);
$('#if_shop_text span').html('Вы хотите купить</br> “'+items[type-1][id][1]+'” </br>за '+items[type-1][id][3]);
$('#if_shop').css({'display':'block'});
lasttype = type-1;
lastid = id;
}
function cancelbuy() {
$('#if_shop').css({'display':'none'});
}
function buyitemok(type,id) {
var items =[ [ ['bg1','Майавыа',0,0],
['bg2','Дикий пляж',0,150],
['bg3','Ямайка',1,2],
['bg4','Вулканный',1,35],
['bg5','Сказочный',1,50],
['bg6','Безмятежность',0,2100],
['bg11','Ямай',2,350]
],
[ ['tree1','Обыкновенная',0,0],
['tree2','Кокосовая',0,150],
['tree3','Майамская',0,120],
['tree4','Симпл-пальма',0,150],
['tree5','Листовая',1,30],
['tree6','"Зеленка"',1,40],
['tree7','"Пушистик"',1,50],
['tree8','"Худая"',0,200],
['tree9','"Двупалая"',1,100],
['tree10','Кокос',0,150]
],
[ ['limb1','"Европейское"',0,30],
['limb2','Пальмовое',0,250],
['limb3','"Редкое"',1,60]
],
[ ['animal1','Зеленый',0,35],
['animal2','Обыкновенный',0,300],
['animal3','Желтоговый',1,120]
],
[ ['girl1','"Jennifer"',0,35],
['girl2','"Loreen"',1,100],
['girl3','"Аи"',1,15],
['girl4','"Анна"',0,600]
]
];
if(items[type][id][2] == 0) {
if(drops < items[type][id][3]) {
$('#no_money').css({'display':'block'});
$('#if_shop').css({'display':'none'});
return;
}
}
else {
if(sheets < items[type][id][3]) {
$('#no_money').css({'display':'block'});
$('#if_shop').css({'display':'none'});
return;
}
}
query('POST','getitem.php',{"viewer_id":viewer_id,"auth_key":auth_key,"type":type,"id":id},
function(data) {
shop = true;
getinf();
$('#if_shop').css({'display':'none'});
},
function() {
});
}
function setitem(type,id) {
query('POST','setitem.php',{"viewer_id":viewer_id,"auth_key":auth_key,"type"type-1),"id":id},
function(data) {
getinf();
},
function() {
});
}
function tobank() {
$('#no_money').css({'display':'none'});
bank();
}
function cancel_tobank() {
$('#no_money').css({'display':'none'});
}
загрузи код на http://dumpz.org и удали его с первого поста