From 5d92b35a7d60397d6fb0e04215623ddce238ec94 Mon Sep 17 00:00:00 2001 From: peterd Date: Sat, 21 Nov 2015 16:36:04 +0100 Subject: [PATCH] new RGB slider demo (update) --- index.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index cb50794..a9a82f5 100644 --- a/index.js +++ b/index.js @@ -508,13 +508,14 @@ this.$cursorG = $elm.find('.cp-rgb-g-cursor'); this.$cursorB = $elm.find('.cp-rgb-b-cursor'); - $elm.on('mousedown', '.cp-rgb-r-cursor, .cp-rgb-g-cursor, .cp-rgb-b-cursor', function(e) { + $elm.on('mousedown', '.cp-rgb-r, .cp-rgb-g, .cp-rgb-b', function(e) { $currentSlider = $(this); - currentRGB = this.className.replace(/cp-rgb-(\D){1}-cursor/, "$1"); - currentOffset = $currentSlider.parent().offset(); - that.currentWidth = $currentSlider.parent()[0].clientWidth; + currentRGB = this.className.replace(/cp-rgb-(\D){1}/, "$1"); + currentOffset = $currentSlider.offset(); + that.currentWidth = $currentSlider[0].clientWidth; $window.on('mousemove.rgb', mouseMove); e.preventDefault && e.preventDefault(); + mouseMove(e); return false; }); $window.on('mouseup', function(e) {