add positioning code for popover on the right side