Djinn of the Fountain's triggered ability will resolve before the instant or sorcery spell that caused it to trigger resolves. It will resolve even if the spell that caused it to trigger is countered or has otherwise left the stack.