Skip to content

Instantly share code, notes, and snippets.

@ElmahdiMahmoud
ElmahdiMahmoud / totop
Last active October 12, 2015 18:47
jquery: Scroll top top
<!-- Backto top html -->
<div class="totop"><a href="#top"></a></div>
/* back to top css */
.totop a {
position: fixed;
right: 5%;
bottom: 10%;
display: none;
background: ;
width: 30px;
@ElmahdiMahmoud
ElmahdiMahmoud / reset.css
Created November 14, 2012 07:27
css: reset stylesheet
/*===== reset ===============*/
html, body, div, span, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, code, del, dfn, em, img, q, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, dialog, figure, footer, header, hgroup, nav, section { margin:0; padding:0; border:0; vertical-align:baseline; }
article, aside, dialog, figure, footer, header, hgroup, nav, section { display:block; }
table { border-collapse:separate; border-spacing:0; }
caption, th, td { text-align:left; font-weight:normal; }
table, td, th { vertical-align:middle; }
blockquote:before, blockquote:after, q:before, q:after { content:""; }
blockquote, q { quotes:"" ""; }
input::-moz-focus-inner { border: 0; }
*:focus { outline: 0; }
@ElmahdiMahmoud
ElmahdiMahmoud / custom.js
Last active October 12, 2015 18:48
js: custom js file
/*
(function($) { //<< begin no conflict function
$(document).ready(function() { //<< begin doc ready
//with portotype
}); //<< end doc ready
})(jQuery); //<< end no conflict function
*/
@ElmahdiMahmoud
ElmahdiMahmoud / gist:4070851
Last active October 12, 2015 18:48
jquery: undefind
if (typeof jQuery == 'undefined')
{
$("body").css('background','red'); // if jQuery is undefined so the let the background be ( RED! )
}
else
{
$("body").css('background','green'); // if jQuery is there so the let the background be ( Green! )
}
@ElmahdiMahmoud
ElmahdiMahmoud / gist:4070980
Created November 14, 2012 08:24
jquery: before
$("#where").before('what');
@ElmahdiMahmoud
ElmahdiMahmoud / functions.php
Last active October 12, 2015 19:38
wp: Limit Post Title by amount of characters
<?php
function short_title($num) {
$limit = $num+1;
$title = str_split(get_the_title());
$length = count($title);
if ($length>=$num) {
$title = array_slice( $title, 0, $num);
$title = implode("",$title)."...";
echo $title;
} else {
@ElmahdiMahmoud
ElmahdiMahmoud / functions.php
Last active October 12, 2015 19:38
wp: Limit Post Content by Amount of Characters
<?php
function short_content($num) {
$limit = $num+1;
$content = str_split(get_the_content());
$length = count($content);
if ($length>=$num) {
$content = array_slice( $content, 0, $num);
$content = implode("",$content)."...";
echo '<p>'.$content.'</p>';
} else {
@ElmahdiMahmoud
ElmahdiMahmoud / theme-options.php
Created November 15, 2012 07:02
wp: Dynamic URL
//Get Link URL
$options[] = array( "name" => "Show a Text Field ( Single Line )",
"desc" => "Enter text into the field",
"id" => $shortname."_linkurl",
"std" => "http://yoursiteurl.com/",
"type" => "text");
<a href="<?php echo get_option('of_linkurl') ?>">LINK TEXT</a>
@ElmahdiMahmoud
ElmahdiMahmoud / resposive.css
Created November 16, 2012 12:14
css: Media Queries for Standard Devices
/* Smartphones (portrait and landscape) ----------- */
@media only screen
and (min-device-width : 320px)
and (max-device-width : 480px) {
/* Styles */
}
/* Smartphones (landscape) ----------- */
@media only screen
and (min-width : 321px) {
@ElmahdiMahmoud
ElmahdiMahmoud / gist:4098919
Last active October 12, 2015 22:48
jquery: Dropdown Menu
//Dropdown menu
$("# li").hover(function(){
$(this).find('ul').stop().slideDown();
},
function(){
$(this).find('ul').stop().slideUp();
});