public void SwingBack(FloatingWindowScope scope, jQueryObject element, Action callback)
        {
            Window.SetTimeout(() =>
            {
                var js = new JsDictionary <string, object>();

                js["left"] = scope.Left;
                js["top"]  = scope.Top;
                element.CSS("display", "block");

                element.Animate(js, EffectDuration.Fast, EffectEasing.Swing, callback);
            }, 1);
        }
        /// <summary>Scrolls to the specified element.</summary>
        /// <param name="container">The element to scroll to.</param>
        /// <param name="duration">The duration of the scroll animation (in seconds).</param>
        /// <param name="easing">The easing effect to apply.</param>
        /// <param name="onComplete">Action to invoke on complete.</param>
        public void ToBottom(jQueryObject container, double duration, EffectEasing easing, Action onComplete)
        {
            // Prepare the animation properties.
            Dictionary props = new Dictionary();
            props[Html.ScrollTop] = container.GetAttribute(Html.ScrollHeight);

            // Animate.
            container.Animate(
                                props, 
                                Helper.Time.ToMsecs(duration), 
                                easing, 
                                delegate
                                    {
                                        Helper.Invoke(onComplete);
                                    });
        }
示例#3
0
        // image deletion function
        static void DeleteImage(jQueryObject item)
        {
            string recycle_icon = "<a href='link/to/recycle/script/when/we/have/js/off' title='Recycle this image' class='ui-icon ui-icon-refresh'>Recycle image</a>";

            item.FadeOut(EffectDuration.Slow, delegate()
            {
                jQueryObject list = jQuery.Select("ul", jQuery.Select("#trash")).Length > 0 ?
                                    jQuery.Select("ul", jQuery.Select("#trash")) :
                                    jQuery.Select("<ul class='gallery ui-helper-reset'/>").AppendTo("#trash");

                item.Find("a.ui-icon-trash").Remove();
                item.Append(recycle_icon).AppendTo(list).FadeIn(EffectDuration.Slow, delegate()
                {
                    item.Animate(new Dictionary("width", "48px"))
                    .Find("img")
                    .Animate(new Dictionary("height", "36px"));
                });
            });
        }
        public void SwingAway(SwingDirection direction, bool simulate, jQueryObject element, Action callback)
        {
            var js = new JsDictionary <string, object>();

            string distance = "3000";

            switch (direction)
            {
            case SwingDirection.TopLeft:
                js["left"] = "-" + distance + "px";
                js["top"]  = "-" + distance + "px";
                break;

            case SwingDirection.Top:
                js["top"] = "-" + distance + "px";
                break;

            case SwingDirection.TopRight:
                js["left"] = distance + "px";
                js["top"]  = "-" + distance + "px";
                break;

            case SwingDirection.Right:
                js["left"] = distance + "px";
                break;

            case SwingDirection.BottomRight:
                js["left"] = distance + "px";
                js["top"]  = distance + "px";
                break;

            case SwingDirection.Bottom:
                js["top"] = distance + "px";
                break;

            case SwingDirection.BottomLeft:
                js["left"] = "-" + distance + "px";
                js["top"]  = distance + "px";
                break;

            case SwingDirection.Left:
                js["left"] = distance + "px";
                break;
            }

            if (simulate)
            {
                element.CSS(js);
                element.CSS("display", "none");
                if (callback != null)
                {
                    callback();
                }
            }
            else
            {
                element.Animate(js, EffectDuration.Slow, EffectEasing.Swing, () =>
                {
                    element.CSS("display", "none");
                    if (callback != null)
                    {
                        callback();
                    }
                });
            }
        }
        // image deletion function
        static void DeleteImage(jQueryObject item)
        {
            string recycle_icon = "<a href='link/to/recycle/script/when/we/have/js/off' title='Recycle this image' class='ui-icon ui-icon-refresh'>Recycle image</a>";

            item.FadeOut(EffectDuration.Slow, delegate()
            {
                jQueryObject list = jQuery.Select("ul", jQuery.Select("#trash")).Length > 0 ?
                                    jQuery.Select("ul", jQuery.Select("#trash")) :
                                    jQuery.Select("<ul class='gallery ui-helper-reset'/>").AppendTo("#trash");

                item.Find("a.ui-icon-trash").Remove();
                item.Append(recycle_icon).AppendTo(list).FadeIn(EffectDuration.Slow, delegate()
                {
                    item.Animate(new Dictionary("width", "48px"))
                        .Find("img")
                        .Animate(new Dictionary("height", "36px"));
                });
            });
        }
        public void SwingAway(SwingDirection direction, bool simulate, jQueryObject element, Action callback)
        {
            var js = new JsDictionary<string, object>();

            string distance = "3000";

            switch (direction)
            {
                case SwingDirection.TopLeft:
                    js["left"] = "-" + distance + "px";
                    js["top"] = "-" + distance + "px";
                    break;
                case SwingDirection.Top:
                    js["top"] = "-" + distance + "px";
                    break;
                case SwingDirection.TopRight:
                    js["left"] = distance + "px";
                    js["top"] = "-" + distance + "px";
                    break;
                case SwingDirection.Right:
                    js["left"] = distance + "px";
                    break;
                case SwingDirection.BottomRight:
                    js["left"] = distance + "px";
                    js["top"] = distance + "px";
                    break;
                case SwingDirection.Bottom:
                    js["top"] = distance + "px";
                    break;
                case SwingDirection.BottomLeft:
                    js["left"] = "-" + distance + "px";
                    js["top"] = distance + "px";
                    break;
                case SwingDirection.Left:
                    js["left"] = distance + "px";
                    break;
            }

            if (simulate)
            {
                element.CSS(js);
                element.CSS("display", "none");
                if (callback != null)
                {
                    callback();
                }
            }
            else element.Animate(js, EffectDuration.Slow, EffectEasing.Swing, () =>
            {
                element.CSS("display", "none");
                if (callback != null)
                {
                    callback();
                }
            });
        }
        public void SwingBack(FloatingWindowScope scope, jQueryObject element, Action callback)
        {
            Window.SetTimeout(() =>
            {
                var js = new JsDictionary<string, object>();

                js["left"] = scope.Left;
                js["top"] = scope.Top;
                element.CSS("display", "block");

                element.Animate(js, EffectDuration.Fast, EffectEasing.Swing, callback);

            }, 1);
        }
 private void Animate(bool isShowing, jQueryObject div, Dictionary properties, Action onComplete)
 {
     div.Animate(
             properties,
             Helper.Time.ToMsecs(SidebarView.SlideDuration),
             EffectEasing.Swing,
             delegate
                     {
                         if (!isShowing) Css.SetDisplay(methodList.Container, false);
                         Helper.Invoke(onComplete);
                     });
 }