View Single Post
Old 03-04-2013, 10:36 AM   PM User | #1
NafaB
New to the CF scene

 
Join Date: Mar 2013
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
NafaB is an unknown quantity at this point
Javascript If statement

Hey guys, I am having trouble trying to merge two codes together to give me a basic if statement. So If the user is a mobile user, include header_mobile.php , else include header.php . I am trying to do this to sort out my navigation bar as mobile users can't view my drop down menus on my navigation bar, due to not having the hover function with touchscreens. Here are the two codes I have I just can't seem to merge them , any help would be great!


Javascript If Statement

<script type="text/javascript">

$(function() {
if( /Android|Mac|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent) ) {
$('.mobile').show();
}else{
$('.desktop').show();
}
});


</script>


PHP Include

<?php include("header.php"); ?>
NafaB is offline   Reply With Quote