Posts

Best way to prevent page scrolling on drag (mobile)

 window.onmousedown= function (e) {            if (isTouchDevice()) {                 $(document).on('touchstart', function (e) {                     e.preventDefault();                 });             } }  window.onmouseup = function (e) {     $(document).off('touchstart'); }

J Query listnav With Custom Scroll Bar

Add this Line // click handler for letters: shows/hides relevant LI's                $('a', $letters).bind(clickEventType, function (e) {                     $list = $('your selector');   //add this line                     $list = $list.find('.mCSB_container'); // add this line                     e.preventDefault();                     var $this = $(this),

Browser & OS Detection Add Class HTML Elements

function addUserAgentClass(keywords) {     for (var i = 0; i < keywords.length; i++) {         if (navigator.userAgent.indexOf(keywords[i]) != -1) {             $("html").addClass(keywords[i].toLowerCase());             return; //Once we find and process a matching keyword, return to prevent less "specific" classes from being added         }     } } addUserAgentClass(["Chrome", "Firefox", "MSIE", "Safari", "Opera", "Mozilla"]); //Browsers listed generally from most-specific to least-specific addUserAgentClass(["Android", "iPhone", "iPad", "Linux", "Mac", "Windows"]); //Platforms, also in order of specificity

Bootstrap Modal Scroll with Alert & Confirm Box

 common.confirm(common.constants.deleteConfirmMsg.replace('[record]', 'record'), function () {             for (var i = 0; i < contract.temp.repairEquipment.length; i++) {                 if (contract.temp.repairEquipment[i].contract_repair_uld_local_id == id) {                     contract.temp.repairEquipment[i].status = 3;                 }             } // add This code after call back Function             if ($('#modalName').is(':visible')) {                 setTimeout(function () {                     $('body').addClass('modal-open');                 }, 500);             }   ...

Jquery validation message insert After bootstrap add on BTN

.validate({    errorPlacement: function(error, element) {        if (element.next().is('.input-group-addon')) {            error.insertAfter(element.parent('.input-group'));        } else {            error.insertAfter(element);        }    },    onkeyup: false })

Bootstrap Modal Date-range Picker Single Picker Month & Years Drop Down & Text area height Problem On Firefox

 //Textarea Design Problem on Firefox Fix     var FF = !(window.mozInnerScreenX == null);     if (FF) {         $('textarea[rows]').each(function (i, el) {             if (!$(el).data('ffRowsFixed')) {                 var rows = parseInt($(el).attr('rows'));                 if (rows > 1) {                     $(el).attr('rows', (rows - 1));                 }                 $(el).data('ffRowsFixed', true);             }         });         //Modal in date Picker Drop Down issue on Firefox Fix         $('.modal').on('show.bs.modal', function () {             $.fn.modal.Con...

Include another HTML file in a HTML file

HTML <div class="container"> <div class="include" data-include="header" id="header"> </div> </div> <div class="container"> <div class="include" data-include="home" id="content"> </div> </div> <div class="container"> <div class="include" data-include="footer"> </div> </div> Add J query library file Java Script     <script>         $(function () {             var includes = $('.include');             jQuery.each(includes, function () {                 var file = 'views/' + $(this).data('include') + '.html';                 $(this).load(file);             });         }); OR <div id="header"> </div>         $(function () {   ...