Posts

File Uploaded Name Rename

**************************Jquery******************************** $(function () {     $(".edit").on('click', 'span', function () {         var input = $('<input />', {             'type': 'text',                 'name': 'unique',                 'value': $(this).html()         });         $(this).parent().append(input);         $(this).remove();         input.focus();     });     $(".edit").on('blur', 'input', function () {         $(this).parent().append($('<span />').html($(this).val()));         $(this).remove();     }); }); ***********************HTML************************************* <div class="edit"> <span class="">TESTING</span> </di...

Small Screen Data-table View

****************************Jquery*********************************** $ ( document ). ready ( function  () {          var   headertext  = [],      headers  =  document . querySelectorAll ( "#customDataTable th" ),      tablerows  =  document . querySelectorAll ( "#customDataTable th" ),      tablebody  =  document . querySelector ( "#customDataTable tbody" );          for  ( var   i  =  0 ;  i  <  headers . length ;  i ++) {              var   current  =  headers [ i ];              headertext . push ( current . textContent . replace ( /\r ? \n | \r/ ,  "" ));      ...

Modal + iOS virtual keyboard

***************************Jquery ************************************* // This entire section makes Bootstrap Modals work with iOS     // This entire section makes Bootstrap Modals work with iOS     if (navigator.userAgent.match(/iPhone|iPad|iPod/i)) {         $('.modal').on('show.bs.modal', function () {             setTimeout(function () {                 scrollLocation = $(window).scrollTop();                 $('.modal')                     .addClass('modal-ios')                     .height($(window).height())                     .css({ 'margin-top': scrollLocation + 'px' });             }, 0);         });     ...

Dynamic resize images in mobile & desktop

 var ww = $("selector").width();     //alert(ww);     $("selector img").each(function () {         var imgwidth = $(this).width();         if (imgwidth > ww) {             $(this).css('width', '100%');             $(this).css('height', 'auto');         }     });

Background Position Fix in I-Pad & Desktop

$(document).ready(function(){     $.backstretch("image name.png"); }); Add Jquery File :- Jquery Backstretch

Touch Device Hover effect

$(document).ready(function() { /* If mobile browser, prevent click on parent nav item from redirecting to URL */ if(is_touch_device()) { //$('.menu > li > a').attr('href' ,'#'); $('.menu li > ul').each(function (index, domEle) { /* Method 1: Use this to modify the href on the <a> to # */ //$(domEle).prev('a').attr('href' ,'#'); /* Method 2: Use this to keep the href on the <a> intact but prevent the default action */ $(domEle).prev('a').click(function(event) { event.preventDefault(); }); }); } }); //check is this a mobile browser function is_touch_device() { return !!('ontouchstart' in window); } </script> 

Stop Drop down in select box click event

jQuery(document).ready(function($){ setTimeout(function () {         $('selector').find('selector').click(function (e) {             e.stopPropagation();         });     }, 1000);   });