Using JS to realize the scrolling of banner graph is mainly the application of timerCreate a few pictures of the banner map first, the last one with the first one, to ensure that the rolling uninterruptedChange the style, you need to note that all the pictures to show in the peer, otherwise you cannot scroll to the leftA function is declared as a timer function,
This article reprinted to http://blog.csdn.net/iunion/article/details/19080259 there are a lot of apps that are starting to use some rolling banner, and I've done it myself, and part of the algorithm is not thoughtful,Just for the sake of realizing the function, after all it was just a few hours of work.Scrolling made 2 types for horizontal and vertical, automatic scrolling interval can be set, rounded corn
First of all, we know that the ScrollView has the Contentsize attribute, set to drag, set this property to 3 Imagevie width.When the initialization is displayed, the direct setting of the contentsize is displayed in the position of the second ImageView, in the ScrollView proxy method, we can determine the value of the contentoffset.x, if the decrease is dragged to the left, and if it is increased, drag to the right.If you drag to the left for 0 to finish, if twice times the width of the imgaevie
On some e-commerce sites can often see a number of scrolling banner, many software in the first use of the same advertising bar, as shown:
In fact, there are controls to implement this effect on the GitHub, but it's also very simple to do, so let's see what we can do today.
Let's take a look at the layout file:
The top of the layout file is a viewpager, using Viewpager to achieve the
. OnDestroy (); }}The comments in the code have been described in detail, and I will not repeat them.Unselected Small dot pointer_disable.xml: shape xmlns: Android = "http://schemas.android.com/apk/res/android" android:shape =" oval "; corners android:radius =/> solid android: Color = "#55000000" /> shape ; Small dot Pointer_focus.xml When selected:shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval" > corners android:radius="0.5dip" />
Achieve resultsImplementation steps
Mouse into Li, the box becomes wider, the other boxes become narrower, the mouse moves away from the large box and reverts to the originalImplementation steps1. Add a background to Li2. Bind the onmouseover event, mouse into Li, the box becomes wider, the other box narrows3. Remove the box and return to the original
Implementation code "Front-end" javascript+jquery for accordion-style scrolling
jquery left and right scrolling focus map banner picture, mouse over show page down
For pages with wide and high widths
Demonstrate
Copy Code code as follows:
Copy Code code as follows:
@charset "Utf-8";
img {border:0px;}
. bannerbox {width:320px; height:150px; overflow:hidden; margin:0px Auto;}
#focus {width:320px; height:150px; clear:both; overflow:hidden; pos
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.