v2.0.1-beta
This commit is contained in:
@ -109,15 +109,7 @@ class Amount {
|
||||
|
||||
class Colors {
|
||||
constructor(elem, changing = false) {
|
||||
this.color = {
|
||||
white: 'blanco',
|
||||
black: 'negro',
|
||||
blue: 'azul',
|
||||
green: 'verde',
|
||||
yellow: 'amarillo',
|
||||
orange: 'naranjo',
|
||||
red: 'rojo'
|
||||
}
|
||||
this.colors = available_colors
|
||||
this.picked = 'blue'
|
||||
this.elem = elem
|
||||
this.input = elem.find('input[name="color"]')
|
||||
@ -129,8 +121,12 @@ class Colors {
|
||||
}
|
||||
setup() {
|
||||
this.elem.find('.circle').each((i, el) => {
|
||||
let color = $(el).attr('class').split(' ')[0]
|
||||
let cssColor = $(el).css('background-color')
|
||||
if (cssColor != this.colors[color]['rgb']) {
|
||||
$(el).css('background-color', this.colors[color]['rgb'])
|
||||
}
|
||||
$(el).click((e) => {
|
||||
let color = $(el).attr('class').split(' ')[0]
|
||||
this.change_color(color)
|
||||
})
|
||||
})
|
||||
@ -140,7 +136,7 @@ class Colors {
|
||||
$(el).removeClass('selected')
|
||||
}
|
||||
change_color(color) {
|
||||
this.picked = this.color[color]
|
||||
this.picked = this.colors[color]['name']
|
||||
this.input.val(this.picked)
|
||||
this.elem.find('.circle').each((i, el) => {
|
||||
this.default_color_format(el)
|
||||
@ -154,17 +150,41 @@ class Colors {
|
||||
|
||||
let ventajas = {
|
||||
elem: $('#ventajas'),
|
||||
fotos: 6,
|
||||
setup: function() {
|
||||
let h = this.elem.css('height')
|
||||
let w = this.elem.css('width')
|
||||
|
||||
this.elem.find('.diagonal').css('borderBottomWidth', h)
|
||||
this.elem.find('.diagonal').css('borderRightWidth', w)
|
||||
|
||||
this.elem.find('.nav.left').click((e) => {
|
||||
this.prev()
|
||||
})
|
||||
this.elem.find('.nav.right').click((e) => {
|
||||
this.next()
|
||||
})
|
||||
},
|
||||
current: 1,
|
||||
next: function() {
|
||||
var n = this.current + 1
|
||||
if (n > this.fotos) {
|
||||
n = 1
|
||||
}
|
||||
this.elem.find('.gallery .image img').attr('src', './assets/images/galeria/foto' + n + '.jpg')
|
||||
this.current = n
|
||||
},
|
||||
prev: function() {
|
||||
var n = this.current - 1
|
||||
if (n < 1) {
|
||||
n = this.fotos
|
||||
}
|
||||
this.elem.find('.gallery .image img').attr('src', './assets/images/galeria/foto' + n + '.jpg')
|
||||
this.current = n
|
||||
}
|
||||
}
|
||||
let dimensiones = {
|
||||
colors: available_colors,
|
||||
picked: 'blue',
|
||||
elem: $('#dimensiones'),
|
||||
setup: function() {
|
||||
this.elem.find('.colores .circle').each((i, el) => {
|
||||
|
Reference in New Issue
Block a user