Posts

Showing posts from June, 2015

Add Active Class With Refresh Page

 $("#Selcetor-name li").click(function () {         var id = $(this).attr("id");         $('#' + id).siblings().find(".active").removeClass("active");         //                       ^ you forgot this         $('#' + id).addClass("active");         localStorage.setItem("selectedolditem", id);     });     var selectedolditem = localStorage.getItem('selectedolditem');     if (selectedolditem != null) {         $('#' + selectedolditem).siblings().find(".active").removeClass("active");         //                                        ^ you forgot this         $('#' + selectedolditem).addClass("active");     } /********************************HTML***********************************/ <ul id="Selcetor-name">                 <li id="test1" class=""><a href="#"><span>test</span&

Accourding Menu

/************************************Jquery***********************************/ $(".Selector h1").click(function () {                if ($(this).next("table").is(":visible")) {                    $(this).next("table").slideUp("slow");                } else {                    $(".menu-items table").slideUp("slow");                    $(this).next("table").slideToggle("slow");                }            }); /************************************HTML***********************************/ <div class="Selector">             <h1 class="catering" style="background-image:url(http://www.carlinosmarket.com/image/data/1_breakfast_goods.jpg);">Breakfast Goods</h1>             <table border="0" cellpadding="0" cellspacing="0" width="100%">                   <tr>                       <td>.........

Get Retina Display & Add Dynamic Retina CSS & Replace Images

/******************************Get DevicePixelRatio ********************************/ (function (window) { window.getDevicePixelRatio = function () { var ratio = 1; // To account for zoom, change to use deviceXDPI instead of systemXDPI if (window.screen.systemXDPI !== undefined && window.screen.logicalXDPI !== undefined && window.screen.systemXDPI > window.screen.logicalXDPI) { // Only allow for values > 1 ratio = window.screen.systemXDPI / window.screen.logicalXDPI; } else if (window.devicePixelRatio !== undefined) { ratio = window.devicePixelRatio; } return ratio; }; })(this); /*********************************Get CSS & Images ********************************/ var devicePixelRatio = window.getDevicePixelRatio();             var path = $("#device1").attr('href');             var fileExt = path.split('.').shift();             var stylesheet = fileExt + '_2x.css';             console.log(path)             console.log(fil

Text Convert Single Letters with Class Name

/*Text Convert Letters with Class Name*/  $.fn.texter = function () {                 //debugger;                 var letters = $(this).html().split(""),                     text = "";                 for (var i in letters) {                     text += "<span class='" + letters[i] + "'>" + letters[i] + "</span>";                     //console.log(letters[i]);                 }                 $(this).html(text);             };             $(".text").texter(); /********************************HTML*******************************************/ <div class="text">Test Message</div>

Bootstrap Navigation Close in Mobile View Single Page

  // To close navigation in single page in Bootstrap     $(".navbar-nav li a").click(function () {         if ($('.navbar-collapse').hasClass("in")) {             $('.navbar-collapse').addClass("collapse");             $('.navbar-collapse').removeClass("in");             $('.navbar-collapse').css('height', 'auto');         }         else {             $('.navbar-collapse').removeClass("collapse");             $('.navbar-collapse').addClass("in");             $('.navbar-collapse').css('height', '0');         }         $('.navbar-collapse').css('height', '0');     }); /**********************************OR***********************************/ $('.navbar-nav a').on('click', function () {         $(".btn-navbar").click(); //bootstrap 2.x         $(".navbar-toggle").c