Click here to Skip to main content
15,914,594 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In the following code I have a panel id Panel7' and div id as 'Amla'. I tried my level best make the text 'amla' to enlarge and show to the user. It is not hapenning. Can any one point out where the mistake lies. This is in content page.

XML
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js">
</script>
<script>
  $(document).ready(function() {
  $("#Panel7").mouseover(function(){
  var div = $("#Amla");
  Amla.animate({ left: '1px' }, "slow");
  Amla.animate({ fontSize: '3em' }, "slow");
  });
 $("#Panel7").mouseleave(function(){
 var div = $("#Amla");
 Amla.animate({ left: '1px' }, "slow");
 Amla.animate({ fontSize: '1em' }, "slow");
  });
});
</script>
</head>
<div>
   <asp:Panel ID="Panel7" runat="server" Width="158" Height="550"  BorderWidth="1" BorderColor="GhostWhite"  BorderStyle="Groove"  style=" margin-top:1px; margin-left:264px; border-top-style:none; border-left-style:none; border-right-color:InfoBackground ">
                <table class="" style=" margin-left:0px;  " width="157">
       <tr>
       <td>
       <asp:Image ID="Image4" runat="server" DescriptionUrl="~/ImagesForHomeAspx/amla.jpg"
       Height="149px" ImageUrl="~/ImagesForHomeAspx/amla.jpg" Width="157px" />
       </td>
       </tr>
       </table>
       <div id="Amla" style="background:#98bf21;height:100px;width:200px;position:absolute;">Amla</div>
Posted

Hi Rajendran,

If you want only enlarge the font size you can use css property.

$("#elemntId").css("fontSize", 20); 
 
Share this answer
 

Problem


JavaScript
var div = $("#Amla");

Amla.animate({ left: '1px' }, "slow");
Amla.animate({ fontSize: '3em' }, "slow");
});

Here you have assigned Amla div to the variable div, but assigning animate event to Amla, which is not defined.

Solution


You should be doing...
JavaScript
var div = $("#Amla");
  
    div.animate({ left: '1px' }, "slow");
    div.animate({ fontSize: '3em' }, "slow");
});
 
Share this answer
 
Comments
S.Rajendran from Coimbatore 22-Apr-14 12:49pm    
Well, I changed like that and also I had to do like: $('#<%=Image4.ClientID %>')
It worked after that.Thank you.
Great. Please accept the answer. :)

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