Looking at your fiddle, and the code you've attached, I guess the problem is that your code will run on DOM ready event, and the impress().init()
will run when it's parsed (so very likely before the DOM is fully ready).
You could include this line after your code:
$(document).ready(function () {
var x2 = -1920;
var y2 = 0;
var resX = $(window).width();
var resY = $(window).height();
var disX = (resX)/1920;
var disY = (resY)/1080;
$("#div2").attr('data-x',disX*x2);
$("#div2").attr('data-y',disY*y2);
impress().init(); // <-- init it here after the values are being set
});