开发者

Rails, Scriptaculous, effect where one element pushes another out of the way

开发者 https://www.devze.com 2022-12-21 19:46 出处:网络
I really like the visual effect where a new element seems to push an old element out of the way. Pretty common thing recently.

I really like the visual effect where a new element seems to push an old element out of the way. Pretty common thing recently.

here is a static example. http://github.com/

However, I'm trying to do it with recently updated products. Also would like to use scriptaculous if at all possible with perio开发者_开发问答dically_call_remote using ruby on rails.


Without writing the code for you, here are the pieces you need to build:

  • an action in Rails that returns the new html. This will most likely render :partial
  • a PrototypeJS Ajax.PeriodicalUpdater to grab the html, and update the div with new items
  • in the updater's success handler, you want to ease the new elements in - use a scriptaculous effect to show the new html into the div, pushing the other elements out of the way. (not sure how you want to do this - you might have to move the existing elements down to accomodate the new ones, but do it slowly. I recommend you get the first two bullets working and then worry about the effects).

There's no specific need to use periodic_call_remote, it can be done entirely with unobtrusive javascript.

0

精彩评论

暂无评论...
验证码 换一张
取 消