javascript - Programatically Scrolling Over Images in a Website -
I am attempting to set up a website using HTML and Javascript which, at one time, sections of an image Displays and clicks, buttons or segment of the image will scroll to a different section of the image.
| ----- | | ----- | | ----- |
-A- | | --B- | | --C- |
----- | | ----- | | ----- |
If an image formed by a combination of A, B and C, I want to display only one segment, AB or C at a time, and to display one by clicking on a button Scroll left or right so if B appears, and if I click on a button inside the B, then I want to scroll the browser to the right and display the display.
I think I can do this by creating three images next to each other, it is quite far enough that one will not see each other, and use javascript to hide scroll buttons, And then to use javascript, scroll to the html anchor that specifies the location of the image.
However, I am having trouble getting images off screen if my small plan is to work, then I have to put an off screen on the left side, and I will have to offset the C to the right. How can i do this Can I do it via HTML? Do I have a better way of getting that functionality?
Thank you!
It may be possible that using pure HTML + CSS anchors but another strong method Some javascript is injected from inside. I think that you are trying to make some visually attractive so that some animation may not hurt.
You do not need to close the images from the screen. By setting overflow
to hidden
, a div will be fine, just create a deviation that is equal to one of your segments, so that you can justify the margins of the internal image is required. If you know jQuery, it can help:
CSS
div {width: 300px; Heigath: 500px; Hidden flurry; #images div contains an image in which the image A, B, and C. HTML & lt; Div id = "picture" & gt; & Lt; Img src = "abc.jpg" width = "900" height = "500" /> & Lt; / Div & gt;
jQuery
$ ('div # images img'). Click (function () {var marginLeft = parseInt ($ (this). CSS ('margin-left'); var new margin left = margin left-300; if (new margin left = gt; = $ (this) $ (W): {new margin left:}, $ 500); Return back;});
Hope it helps, note that you is not to keep them all in one image, this is the only way to do this . You can have inner divisions and images different, and you can animate that internal device. It is up to you.
Comments
Post a Comment