Skip to content

Instantly share code, notes, and snippets.

@oguzhanaslan
oguzhanaslan / ResizingImageJquery.js
Last active February 23, 2020 08:08
Resizing image with jQuery
$(document).ready(function(){
$('.img-responsive').each(function() {
var maxWidth = 180; // Max width for the image
var maxHeight = 3000; // Max height for the image
var ratio = 0; // Used for aspect ratio
var width = $(this).width(); // Current image width
var height = $(this).height(); // Current image height
// Check if the current width is larger than the max
@oguzhanaslan
oguzhanaslan / gist:10524828
Created April 12, 2014 08:34
ie css hack
/*
* Property prefix hacks
*/
/* IE6 only - any combination of these characters */
_ - £ ¬ ¦
/* IE6/7 only - any combination of these characters */
<a href="http://www.facebook.com/sharer.php?u=[URL-TO-SHARE]">Share on Facebook</a>
<a href="http://twitter.com/share?text=[TEXT]&url=[URL-TO-SHARE]">Tweet</a>
<a href="https://plus.google.com/share?url=[URL-TO-SHARE]">Google+ share</a>
@oguzhanaslan
oguzhanaslan / app.js
Created May 11, 2014 15:36
Check if page scroll is at bottom
$('#topScroll').hide();
$(window).scroll(function(){
if ( document.body.scrollHeight - $(this).scrollTop() <= $(this).height() ){
$('#topScroll').show();
} else {
$('#topScroll').hide();
}
});
@oguzhanaslan
oguzhanaslan / x.js
Created May 11, 2014 15:39
Clear form fields - focus
$('textarea, input:text').bind('focus click', function(){
if (this.value == this.defaultValue) {
this.value = '';
}
}).bind('blur', function(){
if (this.value == '') {
this.value = this.defaultValue;
}
});
@oguzhanaslan
oguzhanaslan / logoeffect
Created June 11, 2014 18:07
logoeffect.js
var radius = 0;
var interval = window.setInterval(function() {
$(".logo a").css({
"-webkit-mask": "-webkit-gradient(radial, 17 17, " + radius + ", 17 17, " + (radius + 15) + ", from(rgb(0, 0, 0)), color-stop(0.5, rgba(0, 0, 0, .2)), to(rgb(0, 0, 0)))",
"-o-mask": "-webkit-gradient(radial, 17 17, " + radius + ", 17 17, " + (radius + 15) + ", from(rgb(0, 0, 0)), color-stop(0.5, rgba(0, 0, 0, .2)), to(rgb(0, 0, 0)))",
"-moz-mask": "-webkit-gradient(radial, 17 17, " + radius + ", 17 17, " + (radius + 15) + ", from(rgb(0, 0, 0)), color-stop(0.5, rgba(0, 0, 0, .2)), to(rgb(0, 0, 0)))",
"mask": "-webkit-gradient(radial, 17 17, " + radius + ", 17 17, " + (radius + 15) + ", from(rgb(0, 0, 0)), color-stop(0.5, rgba(0, 0, 0, .2)), to(rgb(0, 0, 0)))"
});
radius++;
@oguzhanaslan
oguzhanaslan / smooth-scrolling.js
Created October 25, 2014 07:42
Smooth Scrolling
$('a[href^="#"]').on('click',function (e) {
e.preventDefault();
var target = this.hash;
$target = $(target);
$('html, body').stop().animate({
'scrollTop': $target.offset().top
}, 900, 'swing', function () {
@oguzhanaslan
oguzhanaslan / strong-password.js
Created October 25, 2014 07:46
Strong Password
$(document).ready(function() {
$('#passwordInput, #confirmPasswordInput').on('keyup', function(e) {
if($('#passwordInput').val() == '' && $('#confirmPasswordInput').val() == '')
{
$('#passwordStrength').removeClass().html('');
return false;
}
@oguzhanaslan
oguzhanaslan / copy-url.js
Created October 25, 2014 07:49
Copy Your URL To Visitors Clipboard Only IE
function copyUrlToClipboard(){
var url = location.href;
window.clipboardData.setData('url',url);
}