Thanks Charlie for your quick reply.

I got it working. The problem was with Master page in MVC may be.

Before I was adding  reference to superfish.js file before the
ContentPlaceHolder for head in master page.

like:
<script type="text/javascript" src="<%=Url.Content("~/Content/webui/
Scripts/jquery-1.3.2.js")%>"></script>
<script type="text/javascript" src="<%=Url.Content("~/Content/webui/
Scripts/superfish.js")%>"></script>
    <script type="text/javascript">
         $(function() {
             $('ul.sf-menu').superfish();

         });

    </script>
<asp:ContentPlaceHolder ID="head" runat="server"/>

But then after googling lot I found that it has problem doing like
this and I need to add reference and script after ContentPlaceHolder
and it works fine.
like:
<script type="text/javascript" src="<%=Url.Content("~/Content/webui/
Scripts/jquery-1.3.2.js")%>"></script>
<asp:ContentPlaceHolder ID="head" runat="server"/>

<script type="text/javascript" src="<%=Url.Content("~/Content/webui/
Scripts/superfish.js")%>"></script>
<script type="text/javascript">
         $(function() {
             $('ul.sf-menu').superfish();

         });
</script>


May be this will help others having similar problem.

Thanks.

On Jul 8, 11:53 am, Charlie <charlie...@gmail.com> wrote:
> As for master vs content pages, have no idea what your MVC looks like or what 
> your templates look like, or directory structure. Best resource for that 
> would be a forum related to MVC.
> As previously suggested, "If problem persists, try posting a link". From my 
> vantage point you have too many issues, and assumptions going on to try to 
> guess what problem is
> Here's an explanation of "External Script 
> File" http://www.htmlgoodies.com/beyond/javascript/article.php/3470901
> HariOm wrote:Charlie, yes you are right. It doesn't recognize the function 
> because it seems there is no respective superfish plugin loaded, but when I 
> look at the HTML in firebug or developer tool in IE then I can see that it 
> has already loaded. Even I manually put the calling of that script ( 
> $('ul.sf-menu').superfish();) in click of any button and it's giving same 
> error. But If I put reference of that script (<script type="text/javascript" 
> src="<%=Url.Content("~/Content/webui/Scripts/ superfish.js")%>"></script>) in 
> local content page then it works fine. But I don't wanna do that because 
> otherwise I have do it for my all individual pages. "Make sure path to your 
> js file is valid, that is where the function is defined." I think the path is 
> OK because If I reference that file locally in addition to site.Master page 
> with same line of code (<script type="text/javascript" 
> src="<%=Url.Content("~/Content/webui/Scripts/ superfish.js")%>"></script>) 
> then it works fine. "Also be sure jquery.js being loaded before plugin js ." 
> I think jquery (1.3.2) is loaded through site.Master (I also try putting it 
> in locally) before it gets to superfish.js. I am also using other jquery 
> plugins and they works ok as the jquery should be loaded before they load. 
> Moreover, I was assuming that we just need to put menu and related script 
> ($('ul.sf-menu').superfish();) in site.Master page and it will be there in 
> all pages and I don't need to call this script on every page. but It seems 
> that I was wrong. Any advice? Lastly, I am not sure about " You can put your 
> function calls into external js file to simplify script management". Is this 
> something header file in c or what? Could you give me an example of this if 
> possible? Thanks again. On Jul 7, 8:45 pm, 
> Charlie<charlie...@gmail.com>wrote:"is not defined function"  error means 
> calling a function that doesn't exist at time it is called. Make sure path to 
> your js file is valid, that is where the function is defined. Also be sure 
> jquery.js being loaded before  plugin js . If problem persists post a link  
> You can put your function calls into external js file to simplify script 
> management HariOm wrote:Hi I am using SuperFish menu plugin to create menu 
> system for my web. It works ok on my home page but doesn't seem to be ok with 
> other pages. The problem is that I can't see "Arrow" in other pages. Then I 
> tried calling it in specific page using same code as master page (like below) 
> then it works. But I need to refer the script again in my content page in 
> addition to master page otherwise it gives error saying 
> "$('ul.sf-menu').superfish()" is not defined function. <script 
> type="text/javascript" src="<%=Url.Content("~/Content/webui/ 
> Scripts/superfish.js")%>"></script> $(function() { 
> $('ul.sf-menu').superfish(); }); But I don't want to include script in every 
> page and if possible I don't want to call this line of code in every page. Is 
> there any solution to this problem or someone having same problem or may be I 
> am doing some stupid thing cause I am still new MVC and JQuery stuffs. Thanks 
> in advance

Reply via email to