chetan
chetan

Reputation: 3255

jQuery not working in JSF(icefaces)

Below is my jasx file where i am including menu.js

<head>
<script src="/js/menu.js" type="text/javascript">
</script>

        </head>

menu.js

    function initMenu() {
alert("ok");
      $('#menu ul').hide();
      $('#menu li a').click(
        function() {
          var checkElement = $(this).next();
          if((checkElement.is('ul')) && (checkElement.is(':visible'))) {
            $('#menu ul:visible').slideUp('normal');  
            return false;
            }
          if((checkElement.is('ul')) && (!checkElement.is(':visible'))) {  

            $('#menu ul:visible').slideUp('normal');
            checkElement.slideDown('normal',function(){
                var offset = $(this).offset();
                $('#menu li a').removeClass('selected');
                $(this).parent().find('a:first').addClass('selected');
                var margin_top = offset.top-210;
                $('div#current').animate({'margin-top':margin_top},2000,'easeOutBounce');                  
            });
            return false;
            }
          }
        );
      }

    $(document).ready(function() {initMenu();});

Upvotes: 0

Views: 1438

Answers (1)

Ali
Ali

Reputation: 353

Icefaces also uses the $ variable, so you'll have to use another variable for jQuery scripts. You will redeclare it like this:

var myJQuery = jQuery.noConflict();

and replace all instances of $ with myJQuery in your jQuery-based scripts.

Upvotes: 1

Related Questions