From 6eb6f4efa091e812ab7fd69585aa9cd9d0d184b7 Mon Sep 17 00:00:00 2001 From: steswinbank Date: Mon, 18 Mar 2013 16:02:16 +0000 Subject: [PATCH] Update for fluid width text boxes Added settings.distanceFromEdge so the cross will stay at the same distance from the right edge of the text box when window size is changed. --- src/jquery.clearsearch.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/jquery.clearsearch.js b/src/jquery.clearsearch.js index dc48f70..16bd37b 100644 --- a/src/jquery.clearsearch.js +++ b/src/jquery.clearsearch.js @@ -37,7 +37,8 @@ 'clearClass' : 'clear_input', 'divClass' : this.clearClass + '_div', 'focusAfterClear' : true, - 'linkText' : '×' + 'linkText' : '×', + 'distanceFromEdge' : 5 }, options); return this.each(function() { var $this = $(this), btn; @@ -75,11 +76,10 @@ } function update() { - var width = $this.outerWidth(), height = $this - .outerHeight(); + var height = $this.outerHeight(); btn.css({ top : height / 2 - btn.height() / 2, - left : width - height / 2 - btn.height() / 2 + right : settings.distanceFromEdge }); }