문제

im beginner in jquery, i need to horizontal accordion menu by using jquery, i found couple of code but i cant use them within master page and content page in asp.net 4.0. how can i define jquery method in asp.net masterpage and content page....here is the jquery sample i wanna use in my page...

contentpage header

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <link href="slidemenu.css" rel="stylesheet" type="text/css" />
<script src="slidemenu.js" type="text/javascript"></script>

endcontent header

maincontent

<script type="text/javascript">
    $('#MainContent').load(Function(){
    slideMenu.build('sm',200,10,10,1);
    });
</script>

here is ul and li tags withi

endmaincontent

도움이 되었습니까?

해결책

To ensure that the DOM hierarchy is fully constructed and the #MainContent element exists, call the required jQuery script within the $(document).ready function:

<script type="text/javascript">
$(document).ready(function() {
    $('#MainContent').load(Function(){
        slideMenu.build('sm',200,10,10,1);
    });
});
</script>

.ready() - jQuery API

다른 팁

try moving the script tag into your content page.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top