Following are the sites where i started learning J Query.
This is a great tutorial, you might find it difficlut to follow this tutorial if you are new to user interface programming. I will be explaining this tutorial in get the work done for your project!.
Following 15 video tutorials are also best to get the concepts in to your mind
Following 3 videos also helped me to a greater extent.
Now, Lets start learning JQuery.
First of all , For this tutorial, JQuery is all about event handling in the user interface, this means that, when you click on something in the user interface, JQuery will catch that event and perform relevant tasks. What are these relevant tasks, relevant tasks means that adding new item to user interface, remove existing item from the user interface. these are the tasks i am referring to.
Also , i would like to address a one of the beauty of JQuery. it is that, if you are using MVC architecture for your web application then, you may find it very useful to click events to retrieve pages from a server.
IF you are a bigginer, i understand the problem you are facing when trying to implement JQuery tabs. most of the tutorials explain how to implement JQuery part, but they dont specifically say how to integrate JQuery, your web site code and .css and other .js libraries to get a working product. I am here to solve that problem!
$(document).ready(function () {
$("#list a").click(function () {
addTab($(this));
});
$('#tabs a.tab').live('click', function () {
// Get the tab name
var contentname = $(this).attr("id") + "_content";
alert(contentname);
if(contentname == "add_content") {
$("#uploadCV").hide();
$("#addNewCV").show();
} else if (contentname == "upload_content") {
$("#addNewCV").hide();
$("#uploadCV").show();
}
// hide all other tabs
////$("#content p").hide();
////
$("#tabs li").removeClass("current");
// show current tab
//$("#" + contentname).show();
$(this).parent().addClass("current");
});
$('#tabs a.remove').live('click', function () {
// Get the tab name
var tabid = $(this).parent().find(".tab").attr("id");
// remove tab and related content
var contentname = tabid + "_content";
$("#" + contentname).remove();
$(this).parent().remove();
// if there is no current tab and if there are still tabs left, show the first one
if ($("#tabs li.current").length == 0 && $("#tabs li").length > 0) {
// find the first tab
var firsttab = $("#tabs li:first-child");
firsttab.addClass("current");
// get its link name and show related content
var firsttabid = $(firsttab).find("a.tab").attr("id");
$("#" + firsttabid + "_content").show();
}
});
});
// $(function () {
function addTab(link) {
alert($(link).attr("rel"));
alert($("#" + $(link).attr("rel")).length);
if ($("#" + $(link).attr("rel")).length != 0)
return;
$("#tabs li").removeClass("current");
$("#content a").hide();
//$("#content upload_content").hide();
$('ul#tabs').append(" " + $(link).html() + " x ");
if ($(link).attr("rel") == "upload") {
$("#addNewCV").hide();
$("#uploadCV").show();
//$("#content").append("
" + $(link).attr("title") + "
"); //$("#content").append("
" + $(link).attr("title") + "
"); //$("#content").append("
"); //$("#content").load("UpLoadCVTab.ascx");
} else if ($(link).attr("rel") == "add") {
$("#uploadCV").hide();
$("#addNewCV").show();
//$("#content").append("
" + $(link).attr("title") + "
"); }
$("#" + $(link).attr("rel") + "_content").show();
// $('a#remove').click(function () {
// $('ul#tabs li:last').remove();
// });
}
$(document).ready(function () {
$("#list a").click(function () {
addTab($(this));
});
$('#tabs a.tab').live('click', function () {
// Get the tab name
var contentname = $(this).attr("id") + "_content";
alert(contentname);
if(contentname == "add_content") {
$("#uploadCV").hide();
$("#addNewCV").show();
} else if (contentname == "upload_content") {
$("#addNewCV").hide();
$("#uploadCV").show();
}
// hide all other tabs
////$("#content p").hide();
////
$("#tabs li").removeClass("current");
// show current tab
//$("#" + contentname).show();
$(this).parent().addClass("current");
});
$('#tabs a.remove').live('click', function () {
// Get the tab name
var tabid = $(this).parent().find(".tab").attr("id");
// remove tab and related content
var contentname = tabid + "_content";
$("#" + contentname).remove();
$(this).parent().remove();
// if there is no current tab and if there are still tabs left, show the first one
if ($("#tabs li.current").length == 0 && $("#tabs li").length > 0) {
// find the first tab
var firsttab = $("#tabs li:first-child");
firsttab.addClass("current");
// get its link name and show related content
var firsttabid = $(firsttab).find("a.tab").attr("id");
$("#" + firsttabid + "_content").show();
}
});
});
// $(function () {
function addTab(link) {
alert($(link).attr("rel"));
alert($("#" + $(link).attr("rel")).length);
if ($("#" + $(link).attr("rel")).length != 0)
return;
$("#tabs li").removeClass("current");
$("#content a").hide();
//$("#content upload_content").hide();
$('ul#tabs').append(" " + $(link).html() + " x ");
if ($(link).attr("rel") == "upload") {
$("#addNewCV").hide();
$("#uploadCV").show();
//$("#content").append("
" + $(link).attr("title") + "
"); //$("#content").append("
" + $(link).attr("title") + "
"); //$("#content").append("
"); //$("#content").load("UpLoadCVTab.ascx");
} else if ($(link).attr("rel") == "add") {
$("#uploadCV").hide();
$("#addNewCV").show();
//$("#content").append("
" + $(link).attr("title") + "
"); }
$("#" + $(link).attr("rel") + "_content").show();
// $('a#remove').click(function () {
// $('ul#tabs li:last').remove();
// });
}
$(document).ready(function () {
$("#list a").click(function () {
addTab($(this));
});
$('#tabs a.tab').live('click', function () {
// Get the tab name
var contentname = $(this).attr("id") + "_content";
alert(contentname);
if(contentname == "add_content") {
$("#uploadCV").hide();
$("#addNewCV").show();
} else if (contentname == "upload_content") {
$("#addNewCV").hide();
$("#uploadCV").show();
}
// hide all other tabs
////$("#content p").hide();
////
$("#tabs li").removeClass("current");
// show current tab
//$("#" + contentname).show();
$(this).parent().addClass("current");
});
$('#tabs a.remove').live('click', function () {
// Get the tab name
var tabid = $(this).parent().find(".tab").attr("id");
// remove tab and related content
var contentname = tabid + "_content";
$("#" + contentname).remove();
$(this).parent().remove();
// if there is no current tab and if there are still tabs left, show the first one
if ($("#tabs li.current").length == 0 && $("#tabs li").length > 0) {
// find the first tab
var firsttab = $("#tabs li:first-child");
firsttab.addClass("current");
// get its link name and show related content
var firsttabid = $(firsttab).find("a.tab").attr("id");
$("#" + firsttabid + "_content").show();
}
});
});
// $(function () {
function addTab(link) {
alert($(link).attr("rel"));
alert($("#" + $(link).attr("rel")).length);
if ($("#" + $(link).attr("rel")).length != 0)
return;
$("#tabs li").removeClass("current");
$("#content a").hide();
//$("#content upload_content").hide();
$('ul#tabs').append(" " + $(link).html() + " x ");
if ($(link).attr("rel") == "upload") {
$("#addNewCV").hide();
$("#uploadCV").show();
//$("#content").append("
" + $(link).attr("title") + "
"); //$("#content").append("
" + $(link).attr("title") + "
"); //$("#content").append("
"); //$("#content").load("UpLoadCVTab.ascx");
} else if ($(link).attr("rel") == "add") {
$("#uploadCV").hide();
$("#addNewCV").show();
//$("#content").append("
" + $(link).attr("title") + "
"); }
$("#" + $(link).attr("rel") + "_content").show();
// $('a#remove').click(function () {
// $('ul#tabs li:last').remove();
// });
}
This is the JQuery code of my application that i will be explaining to you.
If you are familiar with Event Driven Programming, Then it will help you to understand J Query Better. Event Driven Programming is, Program is driven by an event that you perform on the screen with the use of Mouse and keyboard and other input devices. Using Mouse , you can perform click event. J Query can capture those events that you perform on your browser and, than perform tasks on the use interface according to the events.
Following is a simple example of above description.
Let's start with following tutorial.
you can download source code of this tutorial too from the above url.
Let's try to understand this source code.
No comments:
Post a Comment