Jump to content

Search the Community

Showing results for tags '$(document).ready'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • W3Schools
    • General
    • Suggestions
    • Critiques
  • HTML Forums
    • HTML/XHTML
    • CSS
  • Browser Scripting
    • JavaScript
    • VBScript
  • Server Scripting
    • Web Servers
    • Version Control
    • SQL
    • ASP
    • PHP
    • .NET
    • ColdFusion
    • Java/JSP/J2EE
    • CGI
  • XML Forums
    • XML
    • XSLT/XSL-FO
    • Schema
    • Web Services
  • Multimedia
    • Multimedia
    • FLASH

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Languages

Found 1 result

  1. The following code works as intended when a page is loaded with the defined elements, but does not if it is to be called on a MVC partial view rendering. I understand why it doesn’t is because the page has already loaded but the elements this code acts on have not been loaded. I have tried referencing the source of the code in the partial view .ascx file and have also tried loading the code within script tags: these do not work. Any help on how I can get this to work on a partial view/page update would be appreciated. Sliding.js // This is a reduced accordion effect on div class hideableItem elements.//$(document).ready(function () {// $('.itemHeader').click(function () {// In order to get this to work with a partial page update I had to remove the above two lines and// compliment closing brace & parenthesis, then add the following line.$('.itemHeader').live('click', function () { // Get the parent of the item that was previously clicked. var priorSelectedParent = $('.itemHeaderSelected').parent().attr('id'); $('#' + priorSelectedParent + ' .hideableItem').slideUp('fast'); $('#' + priorSelectedParent + ' .itemHeaderSelected').addClass('itemHeader'); $('#' + priorSelectedParent + ' .itemHeader').removeClass('itemHeaderSelected'); // Get the parent of the item that was clicked. var headerParent = $(this).parent().attr('id'); $('#' + headerParent + ' .hideableItem').slideDown('slow'); $('#' + headerParent + ' .itemHeader').addClass('itemHeaderSelected cornersRoundSmall'); $('#' + headerParent + ' .itemHeaderSelected').removeClass('itemHeader'); })//}); // On pages that utilize the accordion effect this causes the div class openingHeader// to open after the page loads.$(document).read(function () { $('.hideableItem').hide(); // Needed to add a slight time delay before triggering the click event. setTimeout(function () { // Select the openingHeader section be open after the page loads. $('.openingHeader').trigger('click'); }, 10);}); Background.ascx file where Sliding.js is to be implemented (shortened for brevity). <script type="text/javascript" src="../../Scripts/Sliding.js"></script> <h2 class="contentTopElement"> Background Information</h2> <div id="slidingPartial" class="slidingInfo cornersRoundSmall"> <div id="summary"> <h3 class="itemHeader openingHeader">Summary of Qualifications</h3> <div class="hideableItem"> <p> Established a...</p> <p> Ability to...</p> </div> </div> <div id="achievements"> <h3 class="itemHeader">Achievements</h3> <div class="hideableItem"> <p> Quality Control...</p> <p> USDA Service…</p> </div> </div></div> Index.aspx file that calls various partial views. <%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<dynamic>" %> <asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server"> <script src="../../Scripts/MicrosoftAjax.debug.js" type="text/javascript"></script> <script src="../../Scripts/MicrosoftMvcAjax.debug.js" type="text/javascript"></script> <script type="text/javascript" src="../../Scripts/Sliding.js"></script> <div class="relativeWrapper"> <div id="leftColumn"> <ul class="sideMenu"> <li class="selectionItem"><%= Ajax.ActionLink("Introduction","Introduction",new AjaxOptions{UpdateTargetId="columnContent"}) %></li> <li class="selectionItem"><%= Ajax.ActionLink("Background","Background",new AjaxOptions{UpdateTargetId="columnContent"}) %></li> <li class="selectionItem"><%= Ajax.ActionLink("Contact","Contact",new AjaxOptions{UpdateTargetId="columnContent"}) %></li> </ul> </div> <div id="rightColumn"> <div id="columnContent"> <%= Html.Partial("Introduction", new AjaxOptions { UpdateTargetId = "columnContent" })%> </div> </div> </div></asp:Content> Thanks,Ken
×
×
  • Create New...