Comments (6)
I was able to accomplish this functionality using this Code:
$wizard = $("#wizard");
$wizard.steps({
onStepChanged: function (event, currentIndex, priorIndex) {
var currentStep = $("#wizard").steps("getStep", currentIndex);
window.location.hash = currentStep.title;
}
});
$(window).hashchange( function(){
var hash = location.hash.replace("#", "");
$steps = $wizard.data("steps");
if (hash == "") {
var firstStep = $wizard.steps("getStep", 0);
hash = firstStep.title;
}
jQuery.each($steps, function (indexInArray, valueOfElement) {
if (valueOfElement.title == hash) {
var $currentIndex = $wizard.steps("getCurrentIndex");
var diferrence = indexInArray - $currentIndex;
for (var i = 0; i < diferrence; i++) {
$wizard.steps("next");
}
for (var i = 0; i > diferrence; i--) {
$wizard.steps("previous");
}
}
});
});
Of course it is not well written JS, but it does the trick for the moment. How can we get this functionality into jQuery Steps?
I was missing two API methods:
$steps = $wizard.data("steps");
This doesn't seem to be the nicest to accomplish what I needed. Why not introduce a getSteps() method?
var $currentIndex = $wizard.steps("getCurrentIndex");
var diferrence = indexInArray - $currentIndex;
for (var i = 0; i < diferrence; i++) {
$wizard.steps("next");
}
for (var i = 0; i > diferrence; i--) {
$wizard.steps("previous");
}
This isn't nice either. The only way to navigate through steps are the next() and previous() methods. Why not have something like goToStep() which takes the desired index as a parameter?
from jquery-steps.
Hi @quasiperfect,
could you explain that a bit more and tell me what the benefit would be please!? Would be super cool ;-)
from jquery-steps.
Hi @rstaib ,
i mean to be able to use the back and forward buttons of the browser to navigate the tabs
that would meany any tab could be linkable and bookmarkable
take a look here http://benalman.com/projects/jquery-hashchange-plugin/
from jquery-steps.
Hey @quasiperfect,
now it is clear to me. Sounds great and thx for contribution! I will implement that in one of my upcoming releases. And actually, it is related to one of my next features where you could jump from any page to a specific step.
I will inform you when it is ready for use.
from jquery-steps.
hi @rstaib,
thanks for your work
from jquery-steps.
I just did a build and failed to see the desired behavior except that changing steps also changes the hash. Navigating to a specific step using a hash in the URI doesn't work.
What is missing here? Maybe I could try to contribute this.
from jquery-steps.
Related Issues (20)
- return to previous step HOT 1
- Add custom previous and next button not through plugin
- Jquery Cloned button not working HOT 2
- enableAllSteps: true is not working HOT 1
- Show the current step only, on init HOT 2
- Code snippets of examples are not not visible on this plugin's own website HOT 5
- how to get access to anchor tags (previous, next and finish)
- Dropzone.js not working when i use this with jquery steps////
- how can I change any option dynamically HOT 1
- Is this project abandoned?
- Code dropdowns dont work HOT 1
- How can I enable previous button for step count 1 only
- how to dynamically hide/show steps based on user input
- LOST STEP FOCUS ON POSTBACK
- Does not work with Gogle Places Autocomplete
- Submit Button
- The code example on the site does not open when clicked on
- How can i remove or add step dynamically based on user input
- change text o style only in Moblie Mode
- How can we reset steps wizard? if a user wants to start form again without page loading.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jquery-steps.