Is there a way to prevent <herf="#">
from causing a page refresh?
I am currently working on improving an older .NET web project that utilizes nyroModal jQuery for displaying lightboxes. However, when I attempt to close the lightbox, nyroModal adds a hash (i.e. #
) to the URL which triggers a page refresh and results in a jarring user experience.
Javascript code:
$(function () {
//set up light box
var width = 766;
var height = 591;
$('.nyroModal').nyroModal({
sizes: {
initW: width, initH: height,
minW: width, minH: height,
w: width, h: height
},
callbacks: {
beforeShowCont: function () {
$('html').css('overflow', 'hidden');
//width = $('.nyroModalCont').width();
//height = $('.nyroModalCont').height();
$('.nyroModalCont').css('width', width);
$('.nyroModalCont').css('height', height);
$('.nyroModalCont iframe').css('width', width);
$('.nyroModalCont iframe').css('height', height);
},
afterResize: function () {
$('html').css('overflow', 'hidden');
},
afterShowCont: function () {
$('html').css('overflow', 'hidden');
},
afterClose: function () {
$('html').css('overflow', 'auto');
//resizeBackground();
}
}
});
});
I would appreciate any assistance in resolving this issue with the hash causing a page refresh. Ideally, I would like the screen position to remain unchanged after the refresh. Thank you!