Sunday, 18 January 2015

JQuery


  1.   Fixed your scroll on particular control in your page.
    <script type="text/jscript">
            $(document).ready(
            function () {
                var $valSum = $(".custom_valsum_anchor");
                if ($valSum.size() > 0) {
                    var backup_ValidationSummaryOnSubmit = ValidationSummaryOnSubmit;
                    ValidationSummaryOnSubmit = function (validationGroup) {
                        var backup_ScrollTo = window.scrollTo;
                        window.scrollTo = function () { };
                        backup_ValidationSummaryOnSubmit(validationGroup);
                        window.scrollTo = backup_ScrollTo;
                        setTimeout(function () { $("body").scrollTo($valSum); }, 1);
                    };
                }
            }

    );
        </script>
    Put your anchor tag in your page where u want scroll bar
    <a class="custom_valsum_anchor" />

    2.       Originally developed and coded by John Resig and worked on by a dedicated team of jQuery evangelists ever since,  jQuery is a fast and compact JavaScript library that allows simplified usage of DOM traversal and modification,  event handling and AJAX as well as giving us more selectors to work with and some nice effects and animations.

    3.       The .ready() function is similar to window.onload handler.  it can be used multiple times within the same HTML document

    4.       JQuery Example 270914

    <!-- This is where we import the minified jQuery library -->
           <script type="text/javascript" src="jquery-1.10.1.min.js"></script>

          <!-- Our jQuery to action the button click -->
           <script type="text/javascript">
            jQuery(document).ready(function(){
                 jQuery("#btn").click(function(){
            alert("Hello World!");
          });
           });
     </script>
    both r same
    // Formal syntax
    jQuery(document).ready(function(){
    });

    5.       Trigger the event in jQuery
    $("#sessionalert").trigger("click");

     


No comments:

Post a Comment