Monday, 20 April 2015

JavaScript Function for Cross OS and Browser......

function identifyBrowser(){
     
            var BrowserName = "Unknown Browser";
            var sUsrAg = navigator.userAgent;
            if(sUsrAg.indexOf("Chrome") > -1) {
                BrowserName = "Chrome";
            } else if (sUsrAg.indexOf("Safari") > -1) {
                BrowserName = "Safari";
            } else if (sUsrAg.indexOf("Opera") > -1) {
                BrowserName = "Opera";
            } else if (sUsrAg.indexOf("Firefox") > -1) {
                BrowserName = "Firefox";
            } else if (sUsrAg.indexOf("MSIE") > -1) {
                BrowserName = "MSIE";
            }
            //console.log(browser.chrome);
            //alert(BrowserName);
     
            var OSName ="Unknown OS";
            if (navigator.userAgent.indexOf("Win")!=-1) OSName="Windows";                  
            if (navigator.userAgent.indexOf("Mac")!=-1) OSName="MacOS";
            if (navigator.userAgent.indexOf("X11")!=-1) OSName="UNIX";
            if (navigator.userAgent.indexOf("Linux")!=-1) OSName="Linux";
            //alert(OSName);
            if(OSName == "Linux"){
                if(BrowserName  == "Chrome"){
                    //alert("" + OSName + BrowserName  );
                }
                else if(BrowserName  == "Firefox"){
                    //alert("" + OSName + BrowserName  );
                }
            }
            if(OSName == "Windows"){
                if(BrowserName  == "Safari"){
                j$('.modal-footer .addBtn_popUp').css('margin-top', '-3px !important');
                    //alert("" + OSName + BrowserName  );
                }
                else if(BrowserName  == "Firefox"){            
                    j$(".col-md-3.padding-left-Zero + div").addClass("S_D_Padding-Left_zeroMozila ");
                    j$(".S_D_Padding-Left_zeroMozila input").addClass("inputMozila");
                    //alert("" + OSName + BrowserName  );
                }
            }
            if(OSName == "MacOS"){
                if(BrowserName  == "Chrome"){
                 j$('body').addClass('Chrome-mac');
                 //alert("" + OSName + BrowserName  );
                }
                else if(BrowserName  == "Firefox"){
                     j$('body').addClass('Firefox-mac');
                }
             
            }
        }




 $(document).ready(function(){
         identifyBrowser();

});

Wednesday, 28 January 2015

E:empty

This pseudo class selects an 'E' element which has no children or content inside it. For example:
HTML
 

1<div></div>
2<div>
3    Hello World!
4</div>
CSS
 

1div:empty{
2    width: 100px;
3    height: 100px;
4    background: green;
5}
In this case, the first <div> element gets selected.

E:not(s)

This expression selects an element E which is not a selector s. For example:
HTML
 

1<p>Lorem Ipsum Donor 1</p>
2<p>Lorem Ipsum Donor 2</p>
3<p>Lorem Ipsum Donor 3</p>
4<p>Lorem Ipsum Donor 4</p>
5<p>Lorem Ipsum Donor 5</p>
CSS
 

1p:not(:first-child){
2    color: green;
3}
In this case, the last 4 <p> tags are colored green. You can put any valid selector inside the :not() pseudo selector.


E:only-child and E:only-of-type

E:only-child selects an E element which is the only element of its parent where as E:only-of-type checks if it is the only sibling of the given type. For example:
HTML
 

1<div>
2    <p>Lorem Ipsum Donor 1</p>
3</div>
4 
5<div>
6    <p>Lorem Ipsum Donor 1</p>
7    <p>Lorem Ipsum Donor 1</p> 
8</div>
CSS

1p:only-child{
2    color: green;
3}
In this case, p:only-child colors the <p> element of the first <div> element.

The :root selector

The :root selector always selects the root of the document which is the <html> element. It has higherspecificity than a normal element selector.
CSS
 

1:root{
2    background: green
3}
4html{
5    background: red;
6}

In this case, a green color background is applied to the <html> element instead of red due to :root's higher specificity.
When dealing with SVG and XML, the :root selector may point to a different element other than the <html>element.

E[foo^="bar"]

Here E stands for an HTML element, foo is an attribute and bar represents a value. This expression selects elements whose "foo" attribute has value that starts with the string "bar". For example:
HTML
 

1<p id="val-1">HTMLxprs</p>
2<p id="val-2">SitePoint</p>
3<p id="val-3">EggheadIO</p>
4<p id="val-4">SotchIO</p>
5<p id="some-val">Not a value</p>

CSS
 

1p[id^="val"]{
2    color: red
3}

The above CSS selector will select only those <p> elements who id attribute has value that starts with "val". In this case, the first four <p> tags are colored red.

E[foo$="bar"]

This expression selects HTML elements whose 'foo' attribute has value that ends with the string 'bar'. For example:
HTML
 

1<p id="val-1">HTMLxprs</p>
2<p id="val-2">SitePoint</p>
3<p id="val-3">EggheadIO</p>
4<p id="val-4">SotchIO</p>
5<p id="some-val">Not a value</p>

CSS
 

1p[id$="val"]{
2    color: red
3}

In this case, only the last <p> tag has an ID attribute whose value ends with the string "val".

E[foo*="bar"]

This expression selects all the HTML elements whose 'foo' attribute has a value containing substring bar. For example:
HTML
 

1<p id="val-1">HTMLxprs</p>
2<p id="val-2">SitePoint</p>
3<p id="val-3">EggheadIO</p>
4<p id="val-4">SotchIO</p>
5<p id="some-val">Not a value</p>

CSS
 

1p[id*="val"]{
2    color: red
3}

In this case, all <p> tags have an ID attribute who value contain the substring "val".