gordonek
gordonek

Reputation: 137

How to include different php file depend on screen resolution

Im working on responsive site in Wordpress.

I want to display totaly different pictures in my slider for mobile devices.

I come up to idea to make 2 different jquery sliders, place them in 2 php files and load them according to specific screen resolution.

How can I load (include) php file on the fly with javascript/jquery? I found sth like:

 if (screen.width >= 720 ) 
 $('#place_holder_div').load('file_from_server.php');

But it doesnt seem to work...

Upvotes: 0

Views: 1383

Answers (1)

wunderdojo
wunderdojo

Reputation: 1027

You can use wp_is_mobile().

It returns true / false. So simply check to see if you're on a mobile device and then conditionally include the slider you want.

Upvotes: 2

Related Questions