Skip to content

Instantly share code, notes, and snippets.

View Origame's full-sized avatar

Ozyr Origame

  • Paris
View GitHub Profile
@Origame
Origame / visibility-transition.scss
Created June 29, 2018 14:49
SCSS - Visibility transition mixin
@keyframes fadeIn {
0% {
opacity: 0;
}
100% {
visibility: visible;
opacity: 1;
}
}
@Origame
Origame / nth-last-child.css
Created October 3, 2017 14:04
CSS : select last X items
//Last 4 items won't have margin
.selector{
margin-bottom: 20px;
&:nth-last-child(-n+4){
margin-bottom: 0;
}
}
@Origame
Origame / flexbox-same-height-div.css
Last active August 3, 2017 09:58
CSS - Flexbox => same height divs / vertically centered content
//SAME HEIGHT + VERTICALLY CENTERED CONTENT
.parent {
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
justify-content: center;
}
@Origame
Origame / togglePasswordText.js
Created March 27, 2017 07:42
JS - toggle encrypted password
var togglePasswordText = function(){
var $showBtn = $('.js-show-password');
var $pw = $('.js-password-toshow');
$showBtn.on('click', function(){
if ( $pw.get(0).type === "password" ){
$pw.get(0).type = 'text';
$showBtn.addClass('active');
}
else{
@Origame
Origame / openMobileMenu.js
Created March 27, 2017 07:40
JS - mobile - open burger menu
//MOBILE MENU MANAGER - MOBILE //ON CLICK
var toggleMobileMenu = function(){
var $menuBtn = $('.js-mobile-menu-toggler');
var $menuContent = $('.js-mobile-menu-content');
var $body = $('body');
var $overlay = $('.overlay');
var viewPort = Nsw.viewPortWidth();
var menuWidth = viewPort - 80;
@Origame
Origame / goToDataLink.js
Created March 27, 2017 07:39
JS - Go to data-link
@Origame
Origame / ismobile.js
Created March 27, 2017 07:38
JS - isMobile / isTablet / isDesk
//Global function
if (!window.Nsw) {
window.Nsw = {};
}
Nsw.viewPortWidth = function() {
var e = window, a = 'inner';
if (!('innerWidth' in window )) {
a = 'client';
e = document.documentElement || document.body;
@Origame
Origame / magento-skin-url.phtml
Created December 13, 2016 18:29
Magento skin url
<!-- this is inside of .phtml files -->
<img src="<?php echo $this->getSkinUrl('images/breadcrumbs_arrow.gif'); ?>" alt="arrow"/>
<!-- this is in cms block -->
<img class="featured-ratings" src="{{skin url='images/ratings.jpg'}}" alt="" />
@Origame
Origame / close-cross-css3.css
Created December 3, 2016 08:16
Close cross CSS3
.pre-header .close{
position: absolute;
top: 25px;
right: 5px;
width: 30px;
height: 30px;
cursor: pointer;
}
.pre-header .close .cross{
@Origame
Origame / isRetinaOrHighDensity.js
Created November 18, 2016 08:48
Retina & high density detect function
function isHighDensity(){
return ((window.matchMedia && (window.matchMedia('only screen and (min-resolution: 124dpi), only screen and (min-resolution: 1.3dppx), only screen and (min-resolution: 48.8dpcm)').matches || window.matchMedia('only screen and (-webkit-min-device-pixel-ratio: 1.3), only screen and (-o-min-device-pixel-ratio: 2.6/2), only screen and (min--moz-device-pixel-ratio: 1.3), only screen and (min-device-pixel-ratio: 1.3)').matches)) || (window.devicePixelRatio && window.devicePixelRatio > 1.3));
}
function isRetina(){
return ((window.matchMedia && (window.matchMedia('only screen and (min-resolution: 192dpi), only screen and (min-resolution: 2dppx), only screen and (min-resolution: 75.6dpcm)').matches || window.matchMedia('only screen and (-webkit-min-device-pixel-ratio: 2), only screen and (-o-min-device-pixel-ratio: 2/1), only screen and (min--moz-device-pixel-ratio: 2), only screen and (min-device-pixel-ratio: 2)').matches)) || (window.devicePixelRatio && window.devicePixelRatio >=