简体   繁体   English

撤消/使用jQuery返回历史

[英]undo / go back in history with jQuery

I'm working on a customizations website completely on jQuery (I'm completely new to coding and because that's the only coding I know as of now). 我正在完全使用jQuery的自定义网站上工作(我是编码的新手,因为这是我目前所知道的唯一编码)。 Here is the link to the project I'm working on for a friend here is the link to it . 这是我正在为一个朋友从事的项目的链接,这是该项目的链接 I want to get the undo button that's on the top right corner to work. 我想使用位于右上角的撤消按钮来工作。

The user clicks on color, then clicks on the bag part and that areas color changes. 用户单击颜色,然后单击袋子部分,然后区域颜色发生变化。 The undo button should undo the current color applied and return to the previous color step by step. 撤消按钮应撤消当前应用的颜色,并逐步返回到先前的颜色。

I'm also stuck at creating a summary for the colors present on the bag part it just shows all the colors I have selected rather than the colors that's present on the bag. 我还坚持为袋子部分上的颜色创建摘要,它只显示我选择的所有颜色,而不是袋子上的颜色。

It would be a great help if some one could help me out with this 2 things. 如果有人可以帮助我解决这两件事,那将是一个很大的帮助。 I have been researching an developing this for the past 3 months. 在过去的3个月中,我一直在研究开发此功能。

Well since you are not changing the url you cannot use the browsers go back or history functionality. 好吧,由于您没有更改网址,因此无法使用浏览器返回或历史记录功能。 What I suggest is keep an array the has all of the possible values in an object. 我建议保留一个数组,该数组在一个对象中具有所有可能的值。 That way if you want to go back you can do something like arr.length-1 to get the previous set of settings. 这样,如果您想返回,则可以执行类似arr.length-1来获取先前的设置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM