Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(function() {
- $("div.blocks:last").hide();
- $("#tabs li").hover(function() {
- $(this).addClass("over");
- }, function() {
- $(this).removeClass("over");
- });
- $("#tabs li").click(function() {
- $("div.blocks").hide();
- $("#" + $(this).attr("title")).show();
- });
- $("a.new_sec").click(function() {
- $('<div></div>').addClass("new_sections").appendTo("#sections form");
- var sectionIndex = $(".new_sections").index($(".new_sections:last"));
- $("<fieldset><legend>New Section</legend></fieldset>").appendTo(".new_sections:eq(" + sectionIndex + ")");
- var fieldsetIndex = $("fieldset").index($(".new_sections:eq(" + sectionIndex + ") fieldset"));
- $('<div class="article"><p><span class="s_title">Section Title</span>: <input type="text" name="title" class="text" /></p><p>Main Article Title: <input type="text" name="a_title[]" class="text" /></p><p>Article Text: <textarea name="a_text[]" class="textarea"></textarea></p><p>Article Image: <input type="file" name="a_image[]" class="text" /></p><p>Link: <input type="text" name="a_link[]" class="text" /></p></div>').css({border:"0", backgroundColor:"#DDD"}).appendTo("fieldset:eq(" + fieldsetIndex + ")");
- $('<a href="/" class="new_art">Add Additional Article it this Section</a> | <a href="/" class="rem_sec">Remove This Section</a>').appendTo("fieldset:eq(" + fieldsetIndex + ")");
- $("fieldset:eq(" + fieldsetIndex + ") a.new_art").click(function() {
- $('<div class="article"><p>Article Title: <input type="text" name="a_title[]" class="text" /></p><p>Article Text: <textarea name="a_text[]" class="textarea"></textarea></p><p>Article Image: <input type="file" name="a_image[]" class="text" /></p><p>Link: <input type="text" name="a_link[]" class="text" /></p><p><a href="#" class="rem_art">Remove This Article</a></p></div>').css({border:"0", backgroundColor:($("fieldset:eq(" + fieldsetIndex + ") div.article:last").css("backgroundColor") == "rgb(221, 221, 221)" || $("fieldset:eq(" + fieldsetIndex + ") div.article:last").css("backgroundColor") == "#ddd" ? "#FFF" : "#DDD")}).insertAfter("fieldset:eq(" + fieldsetIndex + ") div.article:last");
- $("fieldset a.rem_art").click(function() {
- $(this).parent().parent().remove();
- return false;
- });
- return false;
- });
- $("fieldset a.rem_sec").click(function() {
- $(this).parent().remove();
- return false;
- });
- return false;
- });
- });
Add Comment
Please, Sign In to add comment