reactjs detect if list item is in view - scroll

Like instagram feed autoplay when in view, I would like to understand where the scroll and inview logic will be.
I have this setup:
<ContentList>
<Item>
<Item>
<Item>
<Item>
</ContentList>
I have window scroll added to ContentList when it mounts. I dont know if thats a good idea because I dont have direct references to Item's dom to know when it is inside viewport.
Whats the best way to approach this?

Related

Animated TreeView and nested Accordions

I want to achive a Navigation for my application that looks like a TreeView but is animated like a TitledPane. That is, a Transition when expanding/collapsing an item for its content.
What I did so far is to nest multiple Accordions like this:
- TopAccordion
---- TitledPane
------- Accordion
----------TitledPane
----------TitledPane
----------TitledPane
---- TitledPane
------- Accordion
----------TitledPane
----------TitledPane
----------TitledPane
etc. Unfortunately, this results in same ugly transitions (notice the large gap when opening a nested TitledPane):
Is there a way to animate TreeViews and how? I couldn't find a way to do it by looking at the TreeCell/TreeItem API.
Regards,
Sebastian
I think, there exists a way to implement visual effect of opening like in Accordion/TitledPane for TreeView.
What you need to understand is the following thing :
There is a scenegraph (tree of nodes, which are shown on the scene). When you expand a treeItem, some TreeCells are added in the scenegraph, and content of the tree is reallocated. What you need - is to add animation, which will change the height of cells smoohtly, so that scenegraph engine will redraw the cells, while they have an encreasing height.
But you will have to do it be yourself. And I think, there is no direct support from TreeView or TreeCell for that.
You will find this decision working, and find, that it can be implemented for a wide range of situations, you can file an RFE in jfx-jira for animation support.

How is/can the WP7 Office Hub panorama header markup be created?

WP7 Office hub panorama header looks like this:
What is it?
one solid image
two images (one for logo, one for "microsoft Office")
all vector elements
The answer interests me only because I know how to achieve this only in the first two cases.
Basically I need to create a TextBlock in PanoramaHeaderTemplate, that would be like this:
<TextBlock Foreground="Black"><Run Text="smallBold" FontWeight="Bold"/><Run Text="Normal"></TextBlock>
So the resulting panorama should have a look:
If I use FontWeight directive in the PanoramaHeaderTemplate - it for some reason has no effect.
If I use PanoramaTitleTemplate, I get the controllable text weight, but I have a panorama header element appear for some reason, that only displays a x:Key element name of the PanoramaItem, that results in an appearance of a header I don't need at all. This happens even if I don't define the panorama header.
So which is the correct way to achieve the look on the Panorama "upper element", whether it is Title or Header, that is shown on the smallBold.Normal figure?
I don't know what Office uses but it's irrelevant because, as a native app, it wasn't created with Silverlight.
You can create the same effect by changing the Panorama.TitleTemplate to contain whatever you want (TextBlocks, images, etc.). You may also have to adjust the defautl Style applied to the template to set a Height and Width for the PanningTitleLayer.
It's an image, straight across the panorama. It's very simple, as the panorama view was set up to display long images to support a better scrolling feel for the user.
So i would look into using images, as it's easier to achieve, what you are trying to do, with images, rather than a background image.
Some useful related questions/articles:
May Help, StackOverflow
UI Concepts For Windows Phone 7
How I made the ‘myChannel9' wp7 app
Capturing Windows Phone 7 Panorama Images

rollover image for form

Is it possible to have a rollover effect for an image and a form.
I.e. I would like to have an image, which when the user hovers over, rolls away to reveal a form (like a login or sign up form).
Cant find anything out like there like this so assuming its not possible but thought I'd ask!
Thanks
JD
This is very much possible.
Using CSS, say position: absolute for the image and the form's div.
Then using z-index, make sure that the image lies over the form.
Then you can use the HTML onmouseover event to execute something like a call to Adobe Spry's slide animation effect to neatly accomplish what you're trying to do.
But in my honest opinion, this is unnecessary glitter.

Grow Images on Hover like Google Images

Hey everyone, I am trying to accomplish something with images growing on hover like the fancy grow mouseover effect on google images.
Here is what I have:
http://www.1stbusinessneeds.com/tooltip/tooltip.html
The tooltip is offset and is based on the walter zorn tooltip. What's the best way to have the mouseover popup grow out just like google images (with the text), instead of following the mouse?
(I still need it done with the same tooltip - maybe overwrite it, but it must be present to pass the text and image, it's just the positioning and display method of it that I need help creating, any samples would be appreciated)
You might want to look at JQuery.
this might be a good start http://jsfiddle.net/ZwhEu/

Displaying an image when hovering a label

I'm wondering if there is a simple and quick way of displaying an image when the user hovers a QLabel...
Since QLabel can be used to display QPixmap, I would like to display some kind of "preview" when hovering a QLabel...
Do you guys know how I could manage this ?
Thanks in advance !
You can set the tooltip to use html, including <img> tags. Will that do what you need?
As described in the docs, you can override the object's event handler if you need to do something fancier in a tooltip than can be done by default. (such as selecting a particular area of an image to put in the tooltip)
As long as you set the button size large enough, you should be able to capture the mouse-over events and display on mouse-over... but this seems like a somewhat strange way to go about things. Why not display all the images at first?
For those who are interested in the result proposed by jkerian :
Simply :
MyLabel->setToolTip("<html><img src="+MyImagePathAsString+"/></html>");
Will result in :
Thanks again to jkerian.
I don't know what kind of layout your QLabel is in, but I'm guessing it will cause weird layout changes if you just set the pixmap on the label when mouseovering it. Rather use a tooltip or just display a pixmap freely on the canvas.

Resources