Pages

Jquery Are you sure to Submit Confirmation

"Are you sure" alert box with Jquery for submit or a button on click

Jquery Are you sure to Submit Confirmation


Script

<script>
$(':submit[name="topup"][value="Request"]').click(function() {
    return window.confirm(this.title || 'Are you sure?');
});
</script>

Jquery Numbers Only Text Box

Jquery Numbers Only Text Box

Jquery Numbers Only Text Box


HTML Code for number only typed text box

<input class="login"  type="text" onkeypress="return isNumber(event)" name="reserve" id="reserve" />

JQuery Code

<script>
function isNumber(evt) {
    evt = (evt) ? evt : window.event;
    var charCode = (evt.which) ? evt.which : evt.keyCode;
    if (charCode > 31 && (charCode < 48 || charCode > 57)) {
        return false;
    }
    return true;
}
</script>

Jquery move background image horizontally on Scroll

How to Move the background image horizontal with the mouse as you scroll with Jquery and CSS which can also use as a horizontal parallax effect. This is done by adding a css class or an id and changing the background image with the JavaScript.

Jquery move background image horizontally on Scroll


The code

<script>
    $(window).scroll(function() {
        var x = $(this).scrollTop();
        $('.yourDivClass').css('background-position', parseInt(-x / 0.5) + 'px');
    });
</script>

How to Protect PHP include files

Add this .htaccess file to your includes of the views folder of your PHP project to Protect  include files. This file prevents that your .PHP view files are accessed directly from the outside

How to Protect PHP include files

CODE

<Files ~ "\.(htaccess|php)$">
order allow,deny
deny from all
</Files>

JQuery display none div id or class on click function

JQuery display div id or class none on click function by changing the CSS with java script



$("#spinner").click(function () {
    $("#sheet").css("display", "none");
});

Cross browser custom scroll bar

Cross browser custom scroll bar
Cross browser custom scroll bar



Cross browser custom scroll bar with nicescroll jquery plugin including CSS css and custom jquery styles for Responsive and crossbroser custom scroller for the entire browser window

Get nicescroll form google code -
https://code.google.com/p/jquery-nicescroll/downloads/list



<script src="js/jquery.min.js"></script>
<script src="js/jquery.nicescroll.min.js"></script>

<script type="text/javascript">
    $(document).ready(function() {
      $('html').niceScroll({
        autohidemode: 'false',     // Do not hide scrollbar when mouse out
        //cursorborderradius: '0px', // Scroll cursor radius
        background: '#E5E9E7',     // The scrollbar rail color
        cursorwidth: '10px',       // Scroll cursor width
        cursorcolor: '#FE6666',     // Scroll cursor color
        cursorborder:"0",
        boxzoom:true,
        autohidemode:false
      });
    });
  </script>
  <style type="text/css">
    #scroll-area {
      width: 200px;
      height: 200px;
    }
  </style>


Full reference

https://code.google.com/p/jquery-nicescroll/downloads/detail?name=jquery.nicescroll.v290.zip&can=2&q=

Search This Blog