function initBackgroundImage(){
      var blockHeight = window.innerHeight / HEIGHT;
      var blockWidth = window.innerWidth / WIDTH;
      var backX = ($scope.x - H_CENTER) * blockWidth;
      var backXStr = "50%";
      var backY = ($scope.y - V_CENTER) * blockHeight;
      var backYStr = "50%";

      if(backX < 0) {
        backXStr = "calc(50% + "+Math.abs(backX)+"px)";
      } else if (backX > 0){
        backXStr = "calc(50% - "+backX+"px)";
      }
      if(backY < 0) {
        backYStr = "calc(50% + "+Math.abs(backY)+"px)";
      } else if (backY > 0){
        backYStr = "calc(50% - "+backY+"px)";
      }

      $element.css({
        "background-position": backXStr+" "+backYStr
      });
    }
/*
     * Initialize the background image and position
     */
Initialize the background image and position
Initialize the background image and position
function initBackgroundImage(){
      var blockHeight = window.innerHeight / HEIGHT;
      var blockWidth = window.innerWidth / WIDTH;
      var backX = ($scope.x - H_CENTER) * blockWidth;
      var backXStr = "50%";
      var backY = ($scope.y - V_CENTER) * blockHeight;
      var backYStr = "50%";
      if(backX < 0) {
        backXStr = "calc(50% + "+Math.abs(backX)+"px)";
      } else if (backX > 0){
        backXStr = "calc(50% - "+backX+"px)";
      }
      if(backY < 0) {
        backYStr = "calc(50% + "+Math.abs(backY)+"px)";
      } else if (backY > 0){
        backYStr = "calc(50% - "+backY+"px)";
      }
      $element.css({
        "background-position": backXStr+" "+backYStr
      });
    }
function initBackgroundImage ( ) { var blockHeight = window . innerHeight / HEIGHT ; var blockWidth = window . innerWidth / WIDTH ; var backX = ( $scope . x - H_CENTER ) * blockWidth ; var backXStr = "50%" ; var backY = ( $scope . y - V_CENTER ) * blockHeight ; var backYStr = "50%" ; if ( backX < 0 ) { backXStr = "calc(50% + " + Math . abs ( backX ) + "px)" ; } else if ( backX > 0 ) { backXStr = "calc(50% - " + backX + "px)" ; } if ( backY < 0 ) { backYStr = "calc(50% + " + Math . abs ( backY ) + "px)" ; } else if ( backY > 0 ) { backYStr = "calc(50% - " + backY + "px)" ; } $element . css ( { "background-position" : backXStr + " " + backYStr } ) ; }
Initialize the background image and position
Initialize the background image and position