Skip to content

Instantly share code, notes, and snippets.

Avatar

Zine-el Abdine Radoua zearadoua

View GitHub Profile
@zearadoua
zearadoua / got-top.js
Last active Oct 18, 2017
button go-top always stay o top of footer
View got-top.js
// Button go Top
$(window).on('scroll' ,function (event) {
var el = $(".region-footer");
var elTop = el.offset().top;
var windowTop = $(window).scrollTop();
var windowHeight = $(window).height();
var windowBottom = windowTop + windowHeight;
var elVisible = windowBottom - elTop;
@zearadoua
zearadoua / scss
Created Sep 25, 2017
bootstrap mixin for rtl
View scss
@mixin rtl() {
html[dir=rtl] & {
@content;
}
}
// float element right in rtl
@mixin float-columns-right($class, $i: 1, $list: ".col-#{$class}-#{$i}") {
@for $i from (1 + 1) through $grid-columns {
$list: "#{$list}, .col-#{$class}-#{$i}";
@zearadoua
zearadoua / js
Created Oct 18, 2017
prevent call option in non mobile device
View js
// desactivate call option in non mobile device
$(document).on('click', '[href^="tel:"]', function(e){
if( !/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) {
e.preventDefault();
e.stopPropagation();
}
});
@zearadoua
zearadoua / js
Created Oct 18, 2017
show and hide go-top button
View js
$(window).scroll(function () {
if ($(this).scrollTop() > 200) {
$('.go-top').fadeIn(200);
} else {
$('.go-top').fadeOut(200);
}
});
@zearadoua
zearadoua / js
Created Oct 18, 2017
animating go-top
View js
// Animate the scroll to top.
$('.go-top').click(function (event) {
event.preventDefault();
$('html, body').animate({scrollTop: 0}, 300);
})
@zearadoua
zearadoua / ie67891011-css-hacks.txt
Created Oct 20, 2017 — forked from ricardozea/ie67891011-css-hacks.txt
IE CSS hacks - IE6, 7, 8, 9, 10, 11
View ie67891011-css-hacks.txt
IE6 Only
==================
_selector {...}
IE6 & IE7
==================
*html or { _property: }
IE7 Only
==================
@zearadoua
zearadoua / js
Created Nov 3, 2017
insert every 3 column inside a row
View js
fixColHeight = function () {
if ($('.page-search.page-search-node').length) {
var $container = $(".node-search-results");
var $cols = $container.find(".row > div").detach();
$container.empty();
for(var i = 0; i < $cols.length; i++) {
if (i % 3 == 0) {
$container.append($("<div>").addClass("row"));
}
$container.find(".row").last().append($cols.eq(i));
@zearadoua
zearadoua / high-dpi-media.css
Created Nov 13, 2017 — forked from marcedwards/high-dpi-media.css
A CSS media query that captures almost all high DPI aware devices.
View high-dpi-media.css
/* ---------------------------------------------------------- */
/* */
/* A media query that captures: */
/* */
/* - Retina iOS devices */
/* - Retina Macs running Safari */
/* - High DPI Windows PCs running IE 8 and above */
/* - Low DPI Windows PCs running IE, zoomed in */
/* - Low DPI Windows PCs and Macs running Firefox, zoomed in */
/* - Android hdpi devices and above */
@zearadoua
zearadoua / font-smoothing-on-high-dpi-media.css
Created Nov 13, 2017 — forked from dpschen/font-smoothing-on-high-dpi-media.css
Use more beautiful font smoothing on high dpi media devices
View font-smoothing-on-high-dpi-media.css
/* ---------------------------------------------------------- */
/* */
/* A media query that captures: */
/* */
/* - Retina iOS devices */
/* - Retina Macs running Safari */
/* - High DPI Windows PCs running IE 8 and above */
/* - Low DPI Windows PCs running IE, zoomed in */
/* - Low DPI Windows PCs and Macs running Firefox, zoomed in */
/* - Android hdpi devices and above */
@zearadoua
zearadoua / detectSafari.js
Created Jul 2, 2018
detect safari browser
View detectSafari.js
(function($){
"use strict";
if ( /^((?!chrome|android).)*safari/i.test(navigator.userAgent)) {
$("html").addClass("safari-detected");
}
})(jQuery);