• Menu" />
    • Menu" />
      • Menu"/>
        DEVHIDE
        • Home (current)
        • About
        • Contact
        • Cookie
        • Home (current)
        • About
        • Contact
        • Cookie
        • Disclaimer
        • Privacy
        • TOS
        Login Or Sign up

        AngularJS animate navigation

        276 Views Asked by Johnny000 At 08 January 2014 at 16:36 2025-12-09T10:49:06.763000

        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 best solutions below

        2
        Daiwei Daiwei On 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

        • Angular Show All When No Filter Is Supplied
        • Using pagination on a table in AngularJS
        • State with different subviews
        • Getting and passing MVC Model data to AngularJS controller
        • Implementing prerender.io middleware in sails.js
        • Token based authorization in nodejs/ExpressJs and Angular(Single Page Application)
        • AngularJS, Google App Engine and URLrewrite
        • send data from table to another page into forms
        • How to write tests for classes with inheritance
        • angularJS sending OPTIONS instead of POST
        • Receiving POST from external application in AngularJS
        • Metaprogramming AngularJS Filters
        • Reload List after Closing Modal
        • Why is my angularjs site not completely crawlable?
        • Why is separation of JavaScript and HTML a good practice?

        Related Questions in ANGULARJS-ANIMATION

        • Angular.js page transition & $animate.addClass
        • .ng-enter not working in Angular 1.3.14?
        • AngularJS Animation Breaking `position: fixed` Element in Chrome
        • Calling a jqLite function inside a AngularJS directive
        • $animate.cancel does not have the expected behavior
        • Animate (easeOutCirc) a DOM Element using AngularJS
        • ngAnimate with ui-view
        • AngularJS 1.2 ng-show height animation
        • Use effekt with angularjs
        • Animating view navigation forwards and backwards
        • show/hide transition not triggering properly because of ng-animate
        • AngularJS animate navigation
        • angularjs directive to show list of items - want to animate the removal of an item via a button click on that row
        • Angular js ui router animated transitions
        • Angular fadein and fadeout - the standard way without CSS?

        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)

        Popular # Hahtags

        javascript python java c# php android html jquery c++ css ios sql mysql r reactjs

        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?
        .

        Copyright © 2021 Jogjafile Inc.

        • Disclaimer
        • Privacy
        • TOS
        • Homegardensmart
        • Math
        • Aftereffectstemplates