Showing posts with label jQuery. Show all posts
Showing posts with label jQuery. Show all posts

Friday, 5 March 2021

Add and remove a class on click using jQuery

 


<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>

<script>
jQuery(document).ready(function(){
jQuery('#btnSubmit').on('click', function() {
jQuery(this).addClass('toggle').removeClass('codepen');   
});
});
</script>

According To Question:

#jQuery add remove class onclick codepen
#Add Class jQuery
#jQuery Onclick Remove Class And Addclass
#toggle class jQuery
#Onclick Add And Remove Class To Body
#Add Class JavaScript
#jQuery Add Class On Click
#Remove Class In JavaScript
#Add Remove Class Onclick By jQuery


Saturday, 20 February 2021

Change Div Order In Mobile View By jQuery

 

Web View

                             
                           Before Change              After Change 



<html>
    <head>
<title>Change Div Order In Mobile View By jQuery.</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
        <style type="text/css">
           body{
padding:20px;
   }
            #container {
                width:100%;
                margin: 0 auto;
text-align: center;
            }
.display_inline{
border: 2px solid;
width: auto;
display: inline-block;
padding: 150px 100px;
margin: 22px;
font-size: 50px;
color: #fff;
font-family: emoji;
}
#div1{
background:#1a3a5f;
}
#div2{
background:#79286c;
}
@media only screen and (max-width: 600px) {
.display_inline{
width: auto;
display: block !important;
bolder:2px solid red;
padding: 10%;
}
}
           
        </style>
<script src="https://code.jquery.com/jquery-3.5.0.js"></script>
    </head>
    <body>
       
        <div id="container">
            <div id="div1" class="display_inline">
<div class="center">
Div One
                </div>
                
            </div>
            <div id="div2" class="display_inline">
<div class="center">
                    Div Two
                </div>
            </div>  
        </div>
<script type="text/javascript">
function listenWidth( ) {
if (jQuery(window).width() <= 600) {
jQuery("#div2").remove().insertBefore(jQuery("#div1"));
} else {
jQuery("#div2").remove().insertAfter(jQuery("#div1"));
}
}
jQuery(document).ready(function(){
listenWidth();
});
jQuery(window).resize(function() {
listenWidth();
});
</script>
    </body>
</html>


According To Question:

#Change Div Position In Mobile
#How To Change Div Position In Responsive
#jQuery Change Order Of Divs
#Change Order Of Divs Responsive
#Div Order Change jQuery
#jQuery Change Column Order
#Javascript Reorder Divs
#Change Div Position By jQuery


Friday, 1 January 2021

How Can I Remove A Specific Item From An Array by jQuery?




//INPUT
var array = [2020, 2021, 2022, 2023];

console.log(array);

var index = array.indexOf(2020);
if (index > -1) {
  array.splice(index, 1);
}

// OUTPUT  : array = [2021, 2022, 2023]
console.log(array);

Note: Run This Code In Browser Console For Testing

According To Question:
#Remove Specific Element From Array Javascript
#Javascript Remove Object From Array By Value
#Remove Element From Array Jav
#Array Filter
#Splice Javascript
#Jquery Remove Item From Array By Index
#Lodash Remove Item From Array
#Remove Object From Json Array Javascript

Monday, 18 May 2020

The best way to detect a mobile device



<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script>
var isMobile = false;
if( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) {
// some code write for mobile device...
isMobile = true;
}else{
isMobile = false;
}
</script>
</head>
<body>
<div>
<center><h1 id="device"></h1></center>
</div>
<script>
if(isMobile){
jQuery("#device").text("This is mobile device...");
}else{
jQuery("#device").text("This is not mobile device...");
}
</script>
</body>
</html>



Output:

This is...

Wednesday, 1 January 2020

How do I redirect to another webpage by jQuery?


There are many ways you can do page redirect to another webpage by jQuery.

Here I give you two example:
  1. Page redirect to another webpage on document ready by jQuery.
    <script>
    // Page redirect on document document
    jQuery(document).document( function() {
        // Similar behavior as an HTTP redirect
          window.location.replace("https://phpkishan.blogspot.com");  //OR
          window.location = "https://phpkishan.blogspot.com";  //OR
          window.location.href = "https://phpkishan.blogspot.com";  //OR
          window.location.assign("https://phpkishan.blogspot.com");
    }
    </script>

  2. Page redirect to another webpage on button clicking by jQuery.

    <button id="buttonID">Page redirect</button>

    <script>
    // Page redirect on button clicking
    jQuery(document).document( function() {
        jQuery( "#buttonID" ).click(function() {
            window.location.href = "https://phpkishan.blogspot.com/";
        });
    }
    </script>

Friday, 15 November 2019

How can I remove a particular value from an array in JavaScript with Example?


<!DOCTYPE html>
<html>  
<head>
    <title>How can I remove a particular value from an array in JavaScript with Example? -PHP Kishan</title>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js" crossorigin="anonymous"></script>
    <script>  
    jQuery(document).ready(function(){
        orig_array = ['BattleGrounds', 'Fornite Battle Royale', 'League of Legends (LOL)', 'Counter-Strike: Global Offensive (CS: GO)', 'HearthStone', 'Minecraft', 'DOTA 2', 'Apex Legends', 'The Division 2', 'Splatoon 2', 'Rummy'];    //Ex: Game List
        document.getElementById("orig_array").innerHTML = orig_array;
      
      
        remove_game = orig_array.indexOf('Fornite Battle Royale'); // You can remove only one value (Game name)
        if (remove_game > -1) {
          orig_array.splice(remove_game, 1);
        }          
        document.getElementById("new_array").innerHTML = orig_array;
    });
    </script>
</head>
<body>
    <p><strong>Array Games List: </strong><br>=> <span id="orig_array"></span></p>  
    <p><strong>Reomve Game From List: </strong><br>=> Fornite Battle Royale</p>  
    <p><strong>New Array Games List: </strong><br>=> <span id="new_array"></span></p>  
</body>
</html>

Monday, 7 October 2019

How to redirect another webpage using JavaScript?



<!DOCTYPE html>
<html>   
<head>
    <title>How to redirect another webpage using JavaScript? -PHP Kishan</title>
    <script>   
        function new_Location(newurl) {       
            /* The wwindow.location method redirect to another webpage location. */
            window.location = newurl;
           
            // OR //
            /* The window.location.href() method redirect to another webpage location. */
            window.location.href = newurl;
           
            // OR //
            /* The window.location.assign() method loads a new location in the browser. */
            window.location.assign(newurl);
           
            // OR //
            /* The window.location.replace() method current location to redirect a new location in the browser. */
            window.location.replace(newurl);
        }

        var new_url = "https://phpkishan.blogspot.com/"; // Assigen New URL Location
    </script>
</head>
<body>
    <p>You can use any one method as per requirement for redirect your document location.</p>
    <input type="button" value="Redirect to new location" onclick="new_Location(new_url)">
</body>
</html>

Wednesday, 10 July 2019

How do I set and get a cookie with jQuery?

<script type='text/javascript'>
function setCookie(key, value) {
         var expires = new Date();
         expires.setTime(expires.getTime() + (1 * 24 * 60 * 60 * 1000));
         document.cookie = key + '=' + value + ';expires=' + expires.toUTCString();
}
setCookie('Name','Kishan');

function getCookie(key) {
          var keyValue = document.cookie.match('(^|;) ?' + key + '=([^;]*)(;|$)');
          return keyValue ? keyValue[2] : null;
}
getCookie('Name');

// Output: "Kishan"
</script>

Sunday, 19 May 2019

HTML to PDF Example






<!DOCTYPE html>
<html lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>HTML to PDF Example - PHP Kishan</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.0/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.5.3/jspdf.debug.js"></script>
<script src="https://html2canvas.hertzen.com/dist/html2canvas.js"></script>
<style>
.center{text-align: center;}
.pdfdiv{background-color: #d9ec58;margin: 50px;padding:30px;}
.innerdiv{padding: 10px;margin: 15px 0;border: 2px solid #ea5555;}
.loader-div {position: fixed;top: 0;left: 0;width: 100%;height: 100%;background: rgba(0, 0, 0, 0.66);z-index: 9;bottom: 0;display: block;text-align:center;color: #fff;font-size: 22px;padding: 30% 0;}
.dp-img{border: 1px solid #e65959;border-radius: 50%;padding: 12px;margin: 6px;}
.btn-div{margin: 58px auto;}
.downloadpdf{text-align: center;background-color: #27d848;width: max-content;padding: 10px;border-radius: 10px;margin: 0 auto;font-size: 30px;text-decoration-line: none;}
.downloadpdf:hover{background-color: #d1d451;}
</style>
</head>
<body>
    <div class="btn-div center">
        <a class="downloadpdf" href="javascript:;" data-pdf="html2pdf" data-target="pdfdiv">Download PDF</a>
    </div>
    <div id="pdfdiv" class="pdfdiv center">
        <div class="innerdiv">
            <h1>This is a Heading</h1>
            <p>This is a paragraph.</p>
            <h5>This is a image.</h5>
            <div>
                <img class="dp-img" src="image.png" alt="HTML to PDF">
            </div>
        </div>
        <div class="innerdiv">
            <h1>This is a Heading</h1>
            <p>This is a paragraph.</p>
            <h5>This is a image.</h5>
            <div>
                <img class="dp-img" src="image.png" alt="HTML to PDF">
                <img class="dp-img" src="image.png" alt="HTML to PDF">
                <img class="dp-img" src="image.png" alt="HTML to PDF">
                <img class="dp-img" src="image.png" alt="HTML to PDF">
                <img class="dp-img" src="image.png" alt="HTML to PDF">
                <img class="dp-img" src="image.png" alt="HTML to PDF">
                <img class="dp-img" src="image.png" alt="HTML to PDF">
                <img class="dp-img" src="image.png" alt="HTML to PDF">
            </div>
        </div>
        <div class="innerdiv">
            <h1>This is a Heading</h1>
            <p>This is a paragraph.</p>
            <h5>This is a image.</h5>
            <div>
                <img class="dp-img" src="image.png" alt="HTML to PDF">
            </div>
        </div>       
    </div>
    <div class="btn-div center">
        <a class="downloadpdf" href="javascript:;" data-pdf="html2pdf" data-target="pdfdiv">Download PDF</a>
    </div>
    <div class="loader-div">Loading...</div>
<footer>
<script>
jQuery(document).ready(function(){
    jQuery('.loader-div').hide();
    jQuery(".downloadpdf").click(function(e){   
        jQuery('.loader-div').show();
        var pdfname = jQuery(this).data('pdf');
        var pdftarget = jQuery(this).data('target');
        console.log("PDF NAME:" + pdfname + "PDF HTML Div: " + pdftarget);   
       

        var pdfw = jQuery('#'+pdftarget).width();
        var pdfh = jQuery('#'+pdftarget).height();
        // console.log  ('div width: '+ pdfw + ' div height: '+pdfh);       

        html2canvas(document.getElementById(pdftarget)).then(function(canvas) {
            var imgData = canvas.toDataURL("image/jpeg");
            // console.log(imgData);
           
            var pdf = new jsPDF('','px',[pdfw,pdfh]);          
            var pwidth = pdf.internal.pageSize.getWidth();
            var pheight = pdf.internal.pageSize.getHeight();
            // console.log('PDF pwidth: '+ pwidth + ' PDF height: '+pheight);   

            pdf.addImage(imgData, 'JPEG', 0, 0, pwidth, pheight);                  
            pdf.save(pdfname+'.pdf');             
            jQuery('.loader-div').hide();
        }).catch(function(M) {
             console.log(M);   
        });
    });
});
</script>
</footer>
</body>
</html>

Note: All images of HTML page must be on the current domain.

Saturday, 29 December 2018

How to set default image on image loaded broken?



<!DOCTYPE html>
<html class="" lang="en-US">
<head>
<meta charset="UTF-8" /> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://unpkg.com/imagesloaded@4/imagesloaded.pkgd.min.js"></script>
<!-- or -->
<!-- <script src="https://unpkg.com/imagesloaded@4/imagesloaded.pkgd.js"></script> -->
<style type="text/css">.image-thumb {display: inline-block;margin: 10px;}</style>
</head>
<body>
<div id="product_div">
<div class="image-thumb"><img src="image/product_01.jpg" class="thumbnail-img" width="100" height="100"></div>
<div class="image-thumb"><img src="image/product_02.jpg" class="thumbnail-img" width="100" height="100"></div>
<div class="image-thumb"><img src="image/product_03.jpg" class="thumbnail-img" width="100" height="100"></div>
<div class="image-thumb"><img src="image/product_04.jpg" class="thumbnail-img" width="100" height="100"></div>
<div class="image-thumb"><img src="image/product_05.jpg" class="thumbnail-img" width="100" height="100"></div>
<div class="image-thumb"><img src="image/image/product_06.jpg" class="thumbnail-img" width="100" height="100"></div>
<div class="image-thumb"><img src="image/image/product_07.jpg" class="thumbnail-img" width="100" height="100"></div>
</div>

<script type="text/javascript">
jQuery(document).ready(function(){
if (jQuery('#product_div').length) {
jQuery('#product_div').imagesLoaded().always( function( instance ) {
console.log('all images loaded');
}).done( function( instance ) {
console.log('all images successfully loaded');
}).fail( function(instance2) {
console.log('all images loaded, at least one is broken');
}).progress( function( instance, image ) {
var result = image.isLoaded ? 'loaded' : 'broken';
console.log( 'image is => ' + result + ' for ' + image.img.src );
if(result == 'broken'){
var default_images = ["default_01.jpg","default_02.jpg","default_03.jpg","default_04.jpg","default_05.jpg"];
var new_image_name = default_images[Math.floor(Math.random()*default_images.length)];
console.log("default image is" + new_image_name); /* Random image select */
var default_img = 'default_images/' + new_image_name;
image.img.src = default_img;
}
});
}
});
</script>
</body>
</html>

Tuesday, 2 October 2018

How to prevent multiple clicks on submit button in jQuery?

<script type="text/javascript">
    function ValidationEvent() {
      if (name != '' && email != '' && contact != ''){
          return true;
       }
       return false;
    }

    var Validation_result = false;

    jQuery("#enquiry_form").submit(function(e){
       if (jQuery('#enquiry_submit_btn').data('dont') == 1)return;
   
       // submit button disabled for click
       jQuery('#enquiry_submit_btn').data('dont', 1);
      
       // Validation
       Validation_result = ValidationEvent();
      
       if(Validation_result == false){
        // submit button enable for click
        jQuery('#enquiry_submit_btn').data('dont', 0); 
       }
    });

    jQuery('#enquiry_reset_btn').click(function(){
       jQuery('#enquiry_form')[0].reset();
       // submit button enable for click
       jQuery('#enquiry_submit_btn').data('dont', 0); 
    });
</script>

Wednesday, 20 June 2018

Why type="file" does not Work with Safari Browser? in Contact Form 7


Note: Script Must be written in header

<script>
jQuery(function() {
var input_file = [];
jQuery('form.wpcf7-form').on('submit', function() {
console.log("-------------------------------");
var i = 0;
jQuery('input[type=file]').each(function() {
if (jQuery(this).val() === '') {
jQuery(this).attr('type', 'hidden');
input_file[i++] = jQuery(this).attr('name');
}
});
console.log("Type Change File To Hidden: "+input_file);
});

jQuery( document ).ajaxComplete(function() {
//AJAX RESPONSES
console.log("Array in File item: "+input_file.length);
if(input_file.length > 0){
jQuery.each(input_file, function(key, index){
console.log("Type Change Hidden To File: "+key +'=> '+index);
jQuery('input[name='+input_file[key]+']').attr('type', 'file');
});
input_file = [];
}
console.log("Response: " + jQuery(".wpcf7-response-output").html());
});
});
</script>

Please try this and give your review.

Monday, 18 June 2018

Detect Safari Browser Using jQuery

<script>
if (navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1)  {
alert('Now, You are using safari browser...');  
}else{
alert('Now, You are not using safari browser...');
}
</script>


Saturday, 9 June 2018

How to temporarily disable a button click in jQuery?

<script>
$("#button_id").click(function() {
  if($(this).data('dont')==1) return;
  $(this).data('dont',1);

  // Do Process .....

  $(this).data('dont',0);
}

///////// OR /////////

$("#button_id").click(function() {
  if($("#button_id").data('dont')==1) return;
  $("#button_id").data('dont',1);

  // Do Process .....

  $("#button_id").data('dont',0);
}
// Note: Remeber that $.data() would work only for items with ID.
</script>

Monday, 25 September 2017

Uncaught Error: Syntax error, unrecognized expression: [href=#] in ordpress




To temporarily solution
Until your theme developers release a fixed version,
you can add the following code snippet into your theme functions.php file

------------------------------------------------------------------------------------

add_action( 'wp_enqueue_scripts', 'load_old_jquery', 100 );
function load_old_jquery() {
if ( ! is_admin() ) {
wp_deregister_script( 'jquery' );
wp_register_script( 'jquery', ( "//ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js" ), false, '1.11.3' );
wp_enqueue_script( 'jquery' );
}
}

Friday, 25 August 2017

Display spinner with jQuery-ui autocomplete

Add below Class CSS in Your CSS style with loading.gif image

.ui-autocomplete-loading{
background:url('https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh-2CAHF5Z8aPGaK1rsXDzE773kXI9aMrtoTK865ZzNo7VHuhrHJevNyh-dmcMVEDXdB_nMdMlkK1EokWTsbgQgmN7ToHUmWfN3B_JlxIlG5KPPxk5eADuQxyXbMrLSpgivPAzMwNu6l84/s320/loading.gif') no-repeat right center !important;
}



Friday, 24 June 2016

How to add external link in target and class

<head>
    <script src="https://code.jquery.com/jquery-1.9.1.min.js"></script>
    <script type='text/javascript'>
$( document ).ready(function() {

  $('a').filter(function() {
  return this.hostname && this.hostname !== location.hostname;
}).attr('target', '_blank');

  $('a').filter(function() {
  return this.hostname && this.hostname !== location.hostname;
}).addClass("external");

});
    </script>
</head>

Tuesday, 5 April 2016

How to set div height dynamically?

Dynamically Assign Height | PHP Kishan

How to set div height dynamically?

PHP is a server-side scripting language designed for web development but also used as a general-purpose programming language.
PHP is a widely-used, free, and efficient alternative to competitors such as Microsoft's ASP.
Fast, flexible and pragmatic, PHP powers everything from your blog to the most popular websites in the world.

Documentation

A good place to start is by skimming through the ever-growing list of frequently asked questions (with answers, of course). Then have a look at the rest of the online manual and other resources in the documentation section.

Mailing Lists

There are a number of mailing lists devoted to talking about PHP and related projects. This list describes them all, has links to searchable archives for all of the lists, and explains how to subscribe to the lists.

User Groups

Chances are that there is a User Group in your neighborhood, which are generally a great resource both for beginners and experienced PHP users. Check out the User Group listing on PHP.ug to see if there is one close by.

<!DOCTYPE html>
<html>
    <head>
  <style>
  #header_div,#bodycontent_div,#footer_div{
    border:1px solid #000;
    margin: 5px;
    padding: 10px;
    color: #000 !important;
  }
  #header_div{background-color:#E6FF00; text-align: center; }
  #bodycontent_div{background-color:#00FF6F; }
  #footer_div{background-color:#00D3FF; text-align: center; }
 

  </style>
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
 </head>
 <body>
 <div>
  <div id="header_div">
  <h1>How to set div height dynamically?</h1>
   <p>PHP is a server-side scripting language designed for web development but also used as a general-purpose programming language.</p>
   <p>PHP is a widely-used, free, and efficient alternative to competitors such as Microsoft's ASP.</p>
   <p>Fast, flexible and pragmatic, PHP powers everything from your blog to the most popular websites in the world.</p>
  </div>
  <div id="bodycontent_div" class="bodycontent_div">
   <h2>Documentation </h2>
   <p>A good place to start is by skimming through the ever-growing list of frequently asked questions (with answers, of course). Then have a look at the rest of the online manual and other resources in the documentation section.</p>

   <h3>Mailing Lists</h3>
   <p>There are a number of mailing lists devoted to talking about PHP and related projects. This list describes them all, has links to searchable archives for all of the lists, and explains how to subscribe to the lists.</p>
 
   <h4>User Groups</h4>
   <p>Chances are that there is a User Group in your neighborhood, which are generally a great resource both for beginners and experienced PHP users. Check out the User Group listing on PHP.ug to see if there is one close by.</p>

  </div>
  <div id="footer_div">
   <div> MySQL is the most popular database system used with PHP.</div>
 
  </div>
 </div>
 </body>
 <script>
 function assign_body_height(){
 //Dynamically assign height (Only for PC)
   var nav_header = $("#header_div").height();
   var nav_bodycontent = $("#bodycontent_div").height();
   var nav_footer = $("#footer_div").height();
   var screen_height =   window.innerHeight|| document.documentElement.clientHeight || document.body.clientHeight;
 
 
   if((nav_header + nav_bodycontent + nav_footer + 95) < screen_height)
   {
    //alert(screen_height);
    var newHeight = screen_height - (nav_header +  nav_footer + 95) + "px";    
    $(".bodycontent_div").css("height", newHeight);
   }
   else{
    //alert("more height");
    var newHeight = "auto";    
    jQuery(".bodycontent_div").css("height", newHeight);    
   
   }
 
 }

 $(document).ready( function()
 {  
  assign_body_height();
 
 });
 </script>
</html>

Friday, 4 March 2016

Detect Mobile or PC Browsers


<script src="https://code.jquery.com/jquery-1.11.3.js"></script>
<script>

(function(a){(jQuery.browser=jQuery.browser||{}).mobile=/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0,4))})(navigator.userAgent||navigator.vendor||window.opera);


if(jQuery.browser.mobile)
{
   alert('You are using a mobile device!');
}
else
{
   alert('You are not using a mobile device!');
}
</script>