xs: Extra small devices (less than 600px) sm: Small devices (600px and up) md: Medium devices (900px and up) lg: Large devices (1200px and up) xl: Extra large devices (1536px and up) <Box sx={(theme) => ({ textAlign: ‘center’, [theme.breakpoints.up(’md’)]: { textAlign: ‘left’ }, })} > TEXT </Box> theme.breakpoints.up(‘md’) means @media (min-width: 900px) So, the above […]
Posted on March 12, 2024, 6:17 pm, by admin, under
javascript.
const hostname = "www.someaddress.com" console.log(!!hostname.startsWith(’www.’) ? ‘matching’ : ‘not matching’)
Associative arrays in PHP = Javascript Objects written as name value pairs = Hash maps in Java
Posted on July 7, 2017, 3:50 pm, by admin, under
javascript.
<script type="text/javascript"> … $parent = $(’#yourobject’).parent(); $child = $(’#yourobject’).children(’:first’); … </script>
Posted on July 3, 2017, 3:48 pm, by admin, under
javascript.
<a id="my-favourite1"/ class="added"> <a id="my-favourite2"/ class="add"> <a id="my-favourite3"/ class="add"> <a id="my-favourite4"/ class="added"> <a id="my-favourite5"/ class="added"> <script type="text/javascript"> $(’a[id^=my-favourite]’).on(’click’, function (e) { console.log(’Clicked’); console.log(this.id); console.(this.id.removeClass(’added’).addClass(’add’)); } ); </script>
Posted on June 28, 2017, 12:25 pm, by admin, under
javascript.
Avoid using “http://” or “https://” when loading the script in html, css or javascript. The correct example is this: <script type="text/javascript"> $.getScript("//maps.googleapis.com/maps/api/js?key=somekey"); </script>
Posted on June 22, 2017, 9:01 am, by admin, under
javascript.
<script type="text/javascript"> if(/chrom(e|ium)/.test(navigator.userAgent.toLowerCase()) && location.protocol==’http:’) { alert(’Using current position in chrome restricted under http protocol’) } else if (/msie/.test(navigator.userAgent.toLowerCase())) { console.log("This browser is MSIE"); } else if (/firefox/.test(navigator.userAgent.toLowerCase())) { console.log("This browser is Firefox"); } </script>
Posted on August 6, 2015, 5:56 pm, by admin, under
javascript.
window.location.host or document.location.host : you’ll get sub.domain.com:8080 or sub.domain.com:80 window.location.hostname or document.location.hostname: you’ll get sub.domain.com window.location.protocol or document.location.protocol: you’ll get http: window.location.port or document.location.port: you’ll get 8080 or 80 window.location.origin or document.location.origin: you’ll get http://sub.domain.com *