0
Сообщений в теме: 8
#1
Отправлено 02 Июль 2014 - 11:41
Подскажите, пожалуйста. Как сделать, что при нажатии на картинку товара, просто появлялся слайдер в котором можно листать фото, а не открывалась другая страница?? SL-299853
#2
Отправлено 02 Июль 2014 - 13:41
Павел26 (02 Июль 2014 - 11:41) писал:
Подскажите, пожалуйста. Как сделать, что при нажатии на картинку товара, просто появлялся слайдер в котором можно листать фото, а не открывалась другая страница?? SL-299853
Здравствуйте, проблема в файле main.js
Находим
$(function() { if (document.createElement('canvas').getContext) { var image = $('<img />').load(function() { var image = this, offset_left = 5, offset_number = 4; function drawNumberLine(context, position, number, line) { context.drawImage(image, number * 25, line, 25, 1, position * 25 + offset_left + offset_number, line, 25, 1); } function drawNumberBottom(context, position, number) { context.drawImage(image, number * 25, 25, 25, 23, position * 25 + offset_left + offset_number, 25, 25, 23); } function drawNumberTop(context, position, number) { context.drawImage(image, number * 25, 0, 25, 23, position * 25 + offset_left + offset_number, 0, 25, 23); } function cf_draw(from, to, canvas, step) { var context = canvas.getContext('2d'), offsets = [ {w: 2, h: -2}, {w: 4, h: -5}, {w: 6, h: -9}, {w: 8, h: -14}, {w: 10, h: -20}, {w: 0, h: 0}, {w: 10, h: -20}, {w: 8, h: -14}, {w: 6, h: -9}, {w: 4, h: -5}, {w: 2, h: -2}, {w: 0, h: 0} ], width = canvas.width, nwidth = width + offsets[step].w, maxscale = nwidth/width, height = 23, nheight = height + offsets[step].h, scale_y = nheight / height, dig_col = parseInt($(canvas).parents('div.c-block')[0].className.substr(-1), 10); from = from.toString(); to = to.toString(); while (from.length < dig_col) {from = '0' + from;} while (to.length < dig_col) {to = '0' + to;} context.clearRect(0, 0, width, canvas.height); context.save(); for (var j = 0; j <= to.length - 1; j++) { drawNumberTop(context, j, to[j]); } if (step == 11) { for (var j = 0; j <= to.length - 1; j++) { drawNumberBottom(context, j, to[j]); } return; } for (var j = 0; j <= from.length - 1; j++) { drawNumberBottom(context, j, from[j]); } // draw bg context.drawImage(image, 0, 96 + step * 48, width - 5, 48, 0, 0, width - 5, 48); context.drawImage(image, 125, 96 + step * 48, 4, 48, width - 5, 0, 5, 48); for (var i = 0; i < 24; i++) { if (step < 5) { context.setTransform(maxscale - (maxscale - 1) * i / 23, 0, 0, scale_y, -(nwidth - width) / 2 * (1 - i / 23), -offsets[step].h); for (var j = 0; j <= from.length - 1; j++) { drawNumberLine(context, j, from[j], i); } } if (step > 5) { context.setTransform(1 + (maxscale - 1) * i / 23, 0, 0, scale_y, -(nwidth - width) / 2 * (i / 23), -offsets[step].h); for (var j = 0; j <= to.length - 1; j++) { drawNumberLine(context, j, to[j], 25+i); } } context.restore(); } context.setTransform(1, 0, 0, 1, 0, 0); // draw blick context.drawImage(image, 130, 96 + step * 48, width - 5, 48, 0, 0, width - 5, 48); context.drawImage(image, 255, 96 + step * 48, 4, 48, width -5, 0, 5, 48); } function cf_animate(from, to, canvas, step) { cf_draw(from, to, canvas, step); step ++; if (step > 11) return;
Заменяем на
$(function() { if (document.createElement('canvas').getContext) { var image = $('<img />').load(function() { var image = this, offset_left = 5, offset_number = 4; function drawNumberLine(context, position, number, line) { context.drawImage(image, number * 25, line, 25, 1, position * 25 + offset_left + offset_number, line, 25, 1); } function drawNumberBottom(context, position, number) { context.drawImage(image, number * 25, 25, 25, 23, position * 25 + offset_left + offset_number, 25, 25, 23); } function drawNumberTop(context, position, number) { context.drawImage(image, number * 25, 0, 25, 23, position * 25 + offset_left + offset_number, 0, 25, 23); } function cf_draw(from, to, canvas, step) { var context = canvas.getContext('2d'), offsets = [ {w: 2, h: -2}, {w: 4, h: -5}, {w: 6, h: -9}, {w: 8, h: -14}, {w: 10, h: -20}, {w: 0, h: 0}, {w: 10, h: -20}, {w: 8, h: -14}, {w: 6, h: -9}, {w: 4, h: -5}, {w: 2, h: -2}, {w: 0, h: 0} ], width = canvas.width, nwidth = width + offsets[step].w, maxscale = nwidth/width, height = 23, nheight = height + offsets[step].h, scale_y = nheight / height, dig_col = parseInt($(canvas).parents('div.c-block')[0].className.substr(-1), 10); from = from.toString(); to = to.toString(); while (from.length < dig_col) {from = '0' + from;} while (to.length < dig_col) {to = '0' + to;} context.clearRect(0, 0, width, canvas.height); context.save(); for (var j = 0; j <= to.length - 1; j++) { drawNumberTop(context, j, to[j]); } if (step == 11) { for (var j = 0; j <= to.length - 1; j++) { drawNumberBottom(context, j, to[j]); } return; } for (var j = 0; j <= from.length - 1; j++) { drawNumberBottom(context, j, from[j]); } // draw bg context.drawImage(image, 0, 96 + step * 48, width - 5, 48, 0, 0, width - 5, 48); context.drawImage(image, 125, 96 + step * 48, 4, 48, width - 5, 0, 5, 48); for (var i = 0; i < 24; i++) { if (step < 5) { context.setTransform(maxscale - (maxscale - 1) * i / 23, 0, 0, scale_y, -(nwidth - width) / 2 * (1 - i / 23), -offsets[step].h); for (var j = 0; j <= from.length - 1; j++) { drawNumberLine(context, j, from[j], i); } } if (step > 5) { context.setTransform(1 + (maxscale - 1) * i / 23, 0, 0, scale_y, -(nwidth - width) / 2 * (i / 23), -offsets[step].h); for (var j = 0; j <= to.length - 1; j++) { drawNumberLine(context, j, to[j], 25+i); } } context.restore(); } context.setTransform(1, 0, 0, 1, 0, 0); // draw blick context.drawImage(image, 130, 96 + step * 48, width - 5, 48, 0, 0, width - 5, 48); context.drawImage(image, 255, 96 + step * 48, 4, 48, width -5, 0, 5, 48); } function cf_animate(from, to, canvas, step) { cf_draw(from, to, canvas, step); step ++; if (step > 11) return; } }); } });
#3
Отправлено 02 Июль 2014 - 15:35
Не, ничего не получилось... все так же...
#5
Отправлено 02 Июль 2014 - 15:52
$(function() {
jQuery(".basket-info").hover(function() {
jQuery(this).find('.basket-summary').css('display', 'block', 'z-index', '10000');
}, function() {
jQuery(this).find('.basket-summary').css('display', 'none');
});
});
нужно было удалить еще этот блок... вроде теперь норм.. Спасибо)
jQuery(".basket-info").hover(function() {
jQuery(this).find('.basket-summary').css('display', 'block', 'z-index', '10000');
}, function() {
jQuery(this).find('.basket-summary').css('display', 'none');
});
});
нужно было удалить еще этот блок... вроде теперь норм.. Спасибо)
#6
Отправлено 02 Июль 2014 - 15:54
Павел26 (02 Июль 2014 - 15:52) писал:
$(function() {
jQuery(".basket-info").hover(function() {
jQuery(this).find('.basket-summary').css('display', 'block', 'z-index', '10000');
}, function() {
jQuery(this).find('.basket-summary').css('display', 'none');
});
});
нужно было удалить еще этот блок... вроде теперь норм.. Спасибо)
jQuery(".basket-info").hover(function() {
jQuery(this).find('.basket-summary').css('display', 'block', 'z-index', '10000');
}, function() {
jQuery(this).find('.basket-summary').css('display', 'none');
});
});
нужно было удалить еще этот блок... вроде теперь норм.. Спасибо)
Данный блок не нужно удалять.
Нужно Заменить одну часть кода на другую в точности так как написано в инструкции выше.
#7
Отправлено 02 Июль 2014 - 16:14
но когда я просто меняю, ничего не меняется...
#9
Отправлено 02 Июль 2014 - 16:28
Ну да... все корректно работает... блока нет, о котором я говорю... в любом случае, работает и отлично ) Спасибо большое за помощь и оперативность!!!
Количество пользователей, читающих эту тему: 0
0 пользователей, 0 гостей, 0 анонимных