I need to remove # from url when event.value value is == in /. I have a lighbox with jquery.address that stores links to open images, when I close it, I need to remove the # sign because this window causes it to scroll up.
I successfully deleted the # sign with this: window.location.href.slice (0, -1); but, as you can see in the above code, you can rewrite the url when the page loads, and not just after my event.
How can I link this javascript only when my full action happens as this function is called olny when I close the lightboxes.
Here I add my code with comments. Thank you all
$.address.change(function(event) {
curLink = event.value;
if(curLink != '/') {
} else {
$('#element').animate({opacity:"0"},{duration:100, easing:"quartEaseOut", complete: function () {
window.location.href.slice(0, -1);
$(this).hide();
}});
}
});