Brandon Heyer « visit
This is my Source Code and I don't want to show it here
View Source Code only (as overlay)
// That code snippet belongs to Brandon Heyer - http://brandonheyer.com
/**
* @author Heyer
*/
var globalLeft = 0;
function gotoFrame(gotoID, currentBox, speed) {
/* set the hash in the url */
document.location.hash = "!" + gotoID;
/* initialize these to the current, for when we aren't moving from its axis */
var gotoLeftDist = $(currentBox).offset().left;
var gotoTopDist = $(currentBox).offset().top;
var gotoParent = $("#" + gotoID).parent();
var currParent = $(currentBox).parent();
var gridTop = $("#grid").offset().top - $("#container").offset().top;
var currTop = $(currentBox).offset().top;
var gotoTop = $("#" + gotoID).offset().top;
var gotoTopDist = (currTop - gotoTop) + gridTop;
var currLeft = $(currentBox).offset().left;
var gotoLeft = $("#" + gotoID).offset().left;
var gotoLeftDist = (currLeft - gotoLeft) + globalLeft;
globalLeft = gotoLeftDist;
$("#grid").animate({
top: gotoTopDist,
left: gotoLeftDist
}, {
easing: "easeInOutQuint",
duration: speed
});
}
$(document).ready(function(){
$("a.grid_navi").click(function(event){
var parent = $(this).parent();
while (parent.attr("class").toString() != "inner_box") {
parent = parent.parent();
}
gotoFrame($(this).attr("href").substr(1), parent, 1000);
event.preventDefault();
});
$("#portfolio_link").click(function(event) {
$("#main div span").toggle("blind");
event.preventDefault();
});
$("#main div span").hide();
if (document.location.hash != "")
gotoFrame(document.location.hash.substr(2), $("#main"), 0);
});
$(document).ready(function() {
function submitComment() {
var name = $('input[name=name]').val();
var email = $('input[name=email]').val();
var phone = $('input[name=phone]').val();
var comment = $('textarea#ta_comment').val();
var html = $.ajax({
type: 'POST',
url: 'php/ajax.contact.php',
data: 'name=' + name + '&email=' + email + '&phone=' + phone + '&comment=' + comment,
async: false
}).responseText;
return true;
}
function validateName() {
if (jQuery.trim($('input[name=name]').val()) == '') {
return false;
}
return true;
}
function validateEmail() {
if (jQuery.trim($('input[name=email]').val()) == '') {
return false;
}
return true;
}
function validateComment() {
if (jQuery.trim($('textarea#ta_comment').val()) == '') {
return false;
}
return true;
}
$('#error_dialog').dialog({
bgiframe: true,
modal: true,
autoOpen: false,
buttons: {
Ok: function() {
$(this).dialog('close');
}
}
});
$('input[name=submit]').click(function(e){
e.preventDefault();
$('#error_dialog_msgs').empty();
if (!validateName()) {
$('#error_dialog_msgs').append('<div class="dialog_warning">You need to provide a contact name.</div>');
}
if (!validateEmail()) {
$('#error_dialog_msgs').append('<div class="dialog_warning">You need to provide an email address.</div>');
}
if (!validateComment()) {
$('#error_dialog_msgs').append('<div class="dialog_warning">You need to provide a comment or question.</div>');
}
if ($('#error_dialog_msgs').text() != '') {
$('#error_dialog').dialog('option', 'title', 'Error');
$('#error_dialog_msgs').addClass('ui-state-error ui-corner-all');
$('#error_dialog').dialog('open');
} else {
submitComment();
$('input[name=name]').val('');
$('input[name=email]').val('');
$('input[name=phone]').val('');
$('textarea#ta_comment').val('');
$('#error_dialog').dialog('option', 'title', 'Thank you!');
$('#error_dialog_msgs').removeClass('ui-state-error ui-corner-all');
$('#error_dialog_msgs').append('<div class="dialog_thanks">Thank you for your contacting me. I will respond as soon as possible.</div>');
$('#error_dialog').dialog('open');
}
});
});
Syndicate
Categories
Statistics
There are 330 Sites with 745 Links of Interest in 18 Categories. The latest Site was added 4 months ago.
About
This is a project by Sebastian Senf, for his part jQuery user and lover too. Follow me.