Description

The '@input` context query describes information around the input method (i.e. mouse, touch, keyboard) the user is using to interact with the ad and details around such interaction (i.e. mouse position).

Example Usage

Perhaps you had an image of a person you were using in your ad and you wanted the eyes of the person in the photo point in the direction of the position of the mouse. If you had 8 images each with the eyes facing a cardinal direction (N, S, E, W, NE, SE, SW, NW), you could change the image source based on the last known position of the mouse relative to the current component's boundaries.

.eyes {
	/* Mouse is over the ad */
	background-image: url('/assets/eyes-forward.png');
	

	/* Basic Up/Down/Right/Left */	
	@input (ad-top < 0) {
		background-image: url('/assets/eyes-up.png');
	}
	
	@input (ad-left < 0) {
		background-image: url('/assets/eyes-left.png');
	}
	
	@input (ad-right < 0) {
		background-image: url('/assets/eyes-right.png');
	}
	
	@input (ad-bottom < 0) {
		background-image: url('/assets/eyes-down.png');
	}
	
	/* Diagonal Directions */
	
	@input (ad-top < 0) and (ad-left < 0) {
		background-image: url('/assets/eyes-up-left.png');
	}
	
	@input (ad-top < 0) and (ad-right < 0) {
		background-image: url('/assets/eyes-up-right.png');
	}
	
	@input (ad-bottom < 0) and (ad-left < 0) {
		background-image: url('/assets/eyes-down-left.png');
	}
	
	@input (ad-bottom < 0) and (ad-right < 0) {
		background-image: url('/assets/eyes-down-right.png');
	}
}

Available Features

Feature NameJavascript NameValueExample ValueDescription
primary-typeinputPrimaryTypemouse touch keyboard othermouseA string representing the primary input method being used on the current device. In the case of a device having numerous input methods, mouse will override touch, touch will override keyboard, keyboard will override other.
mouseinputMousebooleantrueA boolean describing if the device has a mouse.
touchinputTouchbooleantrueA boolean describing if the device has touch capabilities.
keyboardinputKeyboardbooleantrueA boolean describing if the device has a keyboard.
otherinputOtherbooleantrueA boolean describing if the device has an other type of input method (other than mouse, touch, or keyboard).
movinginputMovingbooleantrueA boolean describing if the mouse is currently moving.
ad-topinputAdTopnumber340The position of the ad's top side relative to the last input y coordinate.
ad-rightinputAdRightnumber-801The position of the ad's right side relative to the last input x coordinate.
ad-bottominputAdBottomnumber290The position of the ad's bottom side relative to the last input y coordinate.
ad-leftinputAdLeftnumber-405The position of the ad's left side relative to the last input x coordinate.
document-topinputDocumentTopnumber736The position of the last input event relative to the top side of the document.
document-rightinputDocumentRIghtnumber873The position of the last input event relative to the right side of the document.
document-bottominputDocumentBottomnumber1046The position of the last input event relative to the bottom side of the document.
document-leftinputDocumentLeftnumber10The position of the last input event relative to the left side of the document.
viewport-topinputViewportTopnumber390The position of the last input event relative to the top side of the viewport.
viewport-rightinputViewportRightnumber826The position of the last input event relative to the right side of the viewport.
viewport-bottominputViewportBottomnumber543The position of the last input event relative to the bottom side of the viewport.
viewport-leftinputViewportLeftnumber-800The position of the last input event relative to the left side of the viewport.
screen-topinputScreenTopnumber78The position of the last input event relative to the top side of the screen.
screen-rightinputScreenRightnumber124The position of the last input event relative to the right side of the screen.
screen-bottominputScreenBottomnumber947The position of the last input event relative to the bottom side of the screen.
screen-leftinputScreenLeftnumber37The position of the last input event relative to the left side of the screen.