From 8d6b4ad8d1273c63c348c2de2bbb1afe439bd94c Mon Sep 17 00:00:00 2001 From: Jason Woofenden Date: Mon, 5 Jan 2015 20:09:21 -0500 Subject: [PATCH] stylus: add h-offset to sprites macros --- stylus-helpers.styl | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/stylus-helpers.styl b/stylus-helpers.styl index 63e917e..701adfb 100644 --- a/stylus-helpers.styl +++ b/stylus-helpers.styl @@ -92,7 +92,7 @@ space-evenly(line_height = 1.2em) // styl: // nav li // sprite-rollover "images/nav.png" 150 35 2 -sprites-rollover(image, width, height, count, h-offset = 0) +sprites-rollover(image, width, height, count, v-offset = 0, h-offset = 0) width: unit(width, px) height: unit(height, px) background-image: url(image) @@ -100,20 +100,20 @@ sprites-rollover(image, width, height, count, h-offset = 0) background-repeat: no-repeat; for n in (0...count) &.n{n} - y = - (@height * n) - h-offset - background-position 0 y + y = - (@height * n) - unit(v-offset, px) + background-position (0 - unit(h-offset, px)) y &:hover - background-position -(@width) y + background-position (0 - unit(h-offset, px) - @width) y // see sprites-rollover -sprites(image, height, count, h-offset = 0) +sprites(image, height, count, v-offset = 0, h-offset = 0) height: unit(height, px) background-image: url(image) background-position: top left background-repeat: no-repeat; for n in (0...count) &.n{n} - y = - (@height * n) - h-offset - background-position 0 y + y = - (@height * n) - unit(v-offset, px) + background-position (0 - unit(h-offset, px)) y // Styling for a variable height element with an image background where the // middle repeats vertically. You must split your image into three images, and -- 1.7.10.4