Structure-behavior-style-angularjs--instruction implementation manual trigger response to page specified location

Source: Internet
Author: User

The recent work needed to enhance the user experience, and the project manager's user experience was poor, so I started thinking about the following instructions. This command allows the user to click on the drop-down or other responses displayed when the screen is not visible because of scrolling, that is, let the user see what he wants to see.

Specific as follows:
define ([' angular '),function(){varCommondirectives = Angular.module ("Commondirectives", []); Commondirectives.directive ("Tolocate",function () {        return{restrict:"AE", scope:{tid:"@", Pscope:"@"}, Link:function(scope, element, Attrs) {Element.bind ("Click",function(event) {event.stoppropagation (); varScroll_offset = $ ("#" +scope.tid). offset (); if(Scope.pscope = =undefined) {                        $("Body,html"). Animate ({scrollTop:scroll_offset.top},1000); }Else{                        $("." +scope.pscope). Animate ({scrollTop:scroll_offset.top},1000); }                })            }        }    })})

Structure-behavior-style-angularjs--instruction implementation manual trigger response to page specified location

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.