Skip to content

Instantly share code, notes, and snippets.

View susanahernandezd's full-sized avatar
🤍

Susana Hernandez susanahernandezd

🤍
View GitHub Profile
@susanahernandezd
susanahernandezd / Parent url Iframe
Created July 1, 2013 07:55
Know parent URL of iframe
$(document).live('click', '#cupon_danet3D', function(event){
var re = /(.*)danet(.*)/g,
//url = document.referrer,
url = document.location.ancestorOrigins[0],
matched = url.match(re);
if(matched){
event.preventDefault();
var urlCupon = $('#cupon_danet3D').attr('href'),
paramDanet = '?utm_source=Danetiframe&utm_medium=Banner_Cupon&utm_campaign=Imprime_Cupon_Productos';
/**
* For modern browsers
* 1. The space content is one way to avoid an Opera bug when the
* contenteditable attribute is included anywhere else in the document.
* Otherwise it causes space to appear at the top and bottom of elements
* that are clearfixed.
* 2. The use of `table` rather than `block` is only necessary if using
* `:before` to contain the top-margins of child elements.
*/
.cf:before,
//Animate to Ancla
//scrollToAnchor('top');
function scrollToAnchor(aid){
var aTag = $("a[name='"+ aid +"']");
$('html,body').animate({scrollTop: aTag.offset().top},'slow');
}
@susanahernandezd
susanahernandezd / ScrollTop Animate
Created September 17, 2013 08:13
Scroll to top
$('html, body').animate({scrollTop:0}, 'slow');
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled</title>
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body>
.loading {
display: none;
position:absolute;
width:100%;
height:100%;
background:#FFFFFF url(../images/loading.gif) 50% 50% no-repeat;
left:0px;
top:0px;
opacity:0.8;
filter:alpha(opacity=80);
@susanahernandezd
susanahernandezd / Menú desplegable.js
Created October 24, 2013 10:28
Menú desplegable jquery
$("#header #ico-mas").on ('mouseover', function() { //cuando mouseover en el link del menu
var $this = $(this),
get_child = $this.parent().find('.child'),
$the_child = $(get_child);
$the_child.stop(true,true).slideDown('medium').show();
$this.parent().hover(function() {
$(document).ready(function(){
$("p").filter(".intro").css("background-color", "yellow");
});
/*
<h1>Welcome to My Homepage</h1>
<p>My name is Donald.</p>
<p class="intro">I live in Duckburg.</p>
<p class="intro">I love Duckburg.</p>
@susanahernandezd
susanahernandezd / is_json
Created January 4, 2018 16:24
Know if a string is a json
function isJSON(str) {
try {
return (JSON.parse(str) && !!str);
} catch (e) {
return false;
}
}
<style>
.page-loader {
background: #fff;
position: fixed;
top: 0;
bottom: 0;
right: 0;
left: 0;
z-index: 9998;