It is not right
location.href = "#modal";
when you need to change hash you need to use window.location.hash=”modal”
but you have another problem!
You need to initialize your plugin and use its api
Instead of this location.href = “#modal”; you need to use:
var inst = jQuery('[data-remodal-id=modal]').remodal();
inst.open()