Click here to Skip to main content
15,901,426 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi, Iam developing a website...It's my first project...The below code animation is working good on Site.Master's <Head> content...

XML
<script type="text/javascript">
           $(document).ready(function () {
               $("#Label1").animate({ fontSize: '76px' }, "slow");
           });
</script>


but when I try to put is on Site.Master's WebForms like MyHome.aspx it's not working...
So where should I use this animation...I found

ASP.NET
<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
I inserted the code here...its not working....?
</asp:Content
>

Is that mistake..thanks for the right directions...?

Thanks & Regards - Paramu
Posted
Comments
bbirajdar 11-Jul-13 5:31am    
When you put the code on master page, then you dont need to put it on the child pages. Check that the ID #Label1 you are using is the ClientID and not the server ID of the control

You need to select the label by its ClientID.
JavaScript
$(document).ready(function () {
    $('#' + '<%= Label1.ClientID %>').animate({ fontSize: '76px' }, "slow");
});
 
Share this answer
 
ASP.NET
<asp:content id="HeaderContent" runat="server" contentplaceholderid="HeadContent">

</asp:content>


You should place your code AND YOUR JS FILES outside this holder in your master page. It's the holder of what you want only to be executed in the master page.

Second thing you have the choice, work with CssClass and $(".myClass") or IDs. If you work with IDs then you should check the Label1 ID if you run your project in a browser. When using Master Page it add something like "MainContent_" before the ID of your controls contained in child pages.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900