Window.location point to (this) link
Hello guys, I'm pretty new to jquery so I may be asking silly questions, but I was wondering if the following was possible.
Say I got this script
- $("#button1").click(function(){$(this).hide(300,function(){
- window.location = "page2.html";
- $("#button1").show("fast");
- });
- });
When button1 is clicked, it hides the element with a nice transition effect and then loads the new page.
(Line 3 is there just in case users press the back button of the browser, the element would be gone unless the page is reloaded)
Now of course I want more than one button. So here's the question: if I set it up like this (below), is there a way to load in the hyperlink of (this) element? I have no idea if and how this could be done
- $(".button").click(function(){$(this).hide(300,function(){
- window.location = this;
- $(this).show("fast");
- });
});
Now I'm creating a button class, and make the script perform the transition effect only on the button that's actually clicked. But of course, the window.location in line 2 doesn't do much at the moment. Can I somehow grab a link that's somehow connected to the individual buttons? I really have no idea if and how this should be done.
Thanks!