• Menu" />
    • Menu" />
      • Menu"/>

        TechQA.

        AngularJS animate navigation

        277 views Asked by Johnny000 At 2014-01-08T16:36:23+00:00 08 January 2014 at 16:36 2025-12-17T12:26:08+00:00

        I have a HTML mockup like this

        <div id="headbar" ng-swipe-left="ToogleMenu()">
          <div id="menu" ng-hide="menuTogglestate">
            <ul>
              <li><a href="#">Menu</a></li>
              ....
            </ul>
          </div>
        </div>
        

        How can I access in my controler in the Togglemenu function the #menu point or call a ng-animation I refer to menu in the mockup? Or do I have to add the animation on top of ng-hide from #menu? As I have a jQuery background, I'm a bit lost with the way AngularJS animations are working. But I don't want to use jQuery at all otherwise I will never lear Angular the right way. Just for the record, I would like to use javascript and not css keyframe animations.

        angularjs angularjs-animation
        Original Q&A
        1

        There are 1 answers

        2
        Daiwei Daiwei On 2014-01-08T22:55:04+00:00 08 January 2014 at 22:55 BEST ANSWER

        Assuming your module variable is app

        app.animation('#menu', function() {
          return {
        
            beforeAddClass : function(element, className, done) {
              if(className == 'ng-hide') {
                jQuery(element).animate({left: -200}, done);
              }
              else {
                done();
              }
            },
        
            removeClass : function(element, className, done) {
              if(className == 'ng-hide') {
                jQuery(element).css({left: -200}).animate({left: 0}, done);
              }
              else {
                done();
              }
            }
        
          };
        });
        

        Related Questions in ANGULARJS

        • How to automatically change path in angular when scrolling
        • Error two clicks to be able to login Angular 16
        • Passing an array of objects through the $http.post method in angular JS does not work
        • Understanding how to apply Angular Signals from beginning on an existing service
        • provider duplicate while compiling a Cordova application for the Android platform
        • How can I use angularjs $parse service in Angular?
        • Width of custom headers in ag-grid (angular) doesn't match with column's width
        • Issues with Katex/ngx-markdown Rendering in Angular 16
        • How to make Angular SSR wait for async operations to finish that are initiated in ngOnInit?
        • I want to install @angular/google-maps npm Package in angular 16.2.12 but "npm install @angular/google-maps" this is not working/ tell me other query
        • Angular 17 standalone application integrate CKEditor 5 -- Error: window is not defined
        • Why is $scope >= 0 showing true in interpolation while empty in controller?
        • The XMLHttpRequest compatibility library was not found
        • Making Gantt Chart Column Labels More Readable
        • Pass key-value pairs of object as individual arguments to component in Angular

        Related Questions in ANGULARJS-ANIMATION

        • AngularJS - Textbox class names are appended with -add when populate with handheld devices
        • Angular 2 Is there a way to get access to the component logic or element style value inside animation metadata
        • ng-repeat end & start sliding animation
        • Calling a jqLite function inside a AngularJS directive
        • Angular Animations with ng-repeat, always fire off ng-enter on array change
        • CSS animation appears on top while animation is running
        • Render leaflet map after flexbox calculates height
        • Can't use CSS ID selector for angular animate transition
        • Angular JS left Panel slider with animation for mobile app (Cordova)
        • Angular Filter and NgAnimate conflict
        • angularjs user feedback message on form submission
        • How to disable animations for changes in dataset for ng-repeat in Angular Material?
        • AngularJS animate element disappearing
        • AngularJS synchronise 2 animations on one element
        • AngularJS: Why are the animation classes not appended during ng-hide/show transition

        Popular Questions

        • How do I undo the most recent local commits in Git?
        • How can I remove a specific item from an array in JavaScript?
        • How do I delete a Git branch locally and remotely?
        • Find all files containing a specific text (string) on Linux?
        • How do I revert a Git repository to a previous commit?
        • How do I create an HTML button that acts like a link?
        • How do I check out a remote Git branch?
        • How do I force "git pull" to overwrite local files?
        • How do I list all files of a directory?
        • How to check whether a string contains a substring in JavaScript?
        • How do I redirect to another webpage?
        • How can I iterate over rows in a Pandas DataFrame?
        • How do I convert a String to an int in Java?
        • Does Python have a string 'contains' substring method?
        • How do I check if a string contains a specific word?

        Trending Questions

        • UIImageView Frame Doesn't Reflect Constraints
        • Is it possible to use adb commands to click on a view by finding its ID?
        • How to create a new web character symbol recognizable by html/javascript?
        • Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
        • Heap Gives Page Fault
        • Connect ffmpeg to Visual Studio 2008
        • Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
        • How to avoid default initialization of objects in std::vector?
        • second argument of the command line arguments in a format other than char** argv or char* argv[]
        • How to improve efficiency of algorithm which generates next lexicographic permutation?
        • Navigating to the another actvity app getting crash in android
        • How to read the particular message format in android and store in sqlite database?
        • Resetting inventory status after order is cancelled
        • Efficiently compute powers of X in SSE/AVX
        • Insert into an external database using ajax and php : POST 500 (Internal Server Error)
        • Privacy
        • Terms
        • Cookies
        • Homegardensmart
        • Math
        • Aftereffectstemplates