Build Step Progress Bar (css and jquery)

前端 未结 7 1356
没有蜡笔的小新
没有蜡笔的小新 2020-12-07 09:18

\"enter

You\'ve seen iterations of this type of progress bar on sites like paypal. Ho

7条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-07 09:33

    What I would do is use the same trick often use for hovering on buttons. Prepare an image that has 2 parts: (1) a top half which is greyed out, meaning incomplete, and (2) a bottom half which is colored in, meaning completed. Use the same image 4 times to make up the 4 steps of the progress bar, and align top for incomplete steps, and align bottom for incomplete steps.

    In order to take advantage of image alignment, you'd have to use the image as the background for 4 divs, rather than using the img element.

    This is the CSS for background image alignment:

    div.progress-incomplete {
      background-position: top;
    }
    div.progress-finished {
      background-position: bottom;
    }
    

提交回复
热议问题