![]() |
Code Help
Ok...I'm working on a website:
I have a large logo with an image map <map> used as a nav bar in index.html. on the other pages I have a smaller version of the same image map. my question is, using JavaScript and HTML5, how can I get the larger image to shrink down and move to the other one, and THEN hyperlink. It feels like I need to code a series of events in JavaScript, but I'M not sure how to do it. any help would be appreciated! Thanks! |
Re: Code Help
So you're saying that you have one big image on a map as your nav bar. The part I'm not sure I understand: "how can I get the larger image to shrink down and move to the other one."
Are you saying you want the nav bar to shrink on your home page? Or do you want the nav bar on your other pages to have a scaled image map? |
Re: Code Help
You might want to look at CSS Animations
|
Re: Code Help
The main page is a image mapped version of our logo, with different page names on it. I have the same concept, but smaller, in the corner of the other pages (upper left) I currently have it hyperlinking when a mapped section is clicked, but I want to delay the hyperlink and have the logo move and shrink to the size and location of the other one beforehand, then hyperlink afterwards. did that help?
|
Re: Code Help
From what you said, I'm getting:
So, on your home page, you have a big image with an image map. On hovering that image, you want the whole image to shrink to the same size as in your other pages, and then have various hyperlinks on it. If the hover is taken off, you still want the image to stay small. If the above is true, I would say you first devise some way to shrink the large image, whether with a gif file or with a CSS animation, as RoboSteve said. Instead of delaying the hyperlink, you may just want to remove the image map for the large image, unless you want to scale the image map with CSS. If you only want to hover the image one time before shrinking, you may just need to add a "onmousehover" attribute to your large logo, in which you could put the new shrunken down image. Please clarify if you don't think I get it or if you're still not sure what to do. I still don't feel I quite understand. |
Re: Code Help
close, but I want it to get small after CLICKING, then hyperlink, without a second click. It seems like something that would be REALLY difficult.
|
Re: Code Help
The best way to accomplish this is to use JQuery to select the image, make it smaller, then redirect the window to the page you want. If you haven't heard of JQuery, it's basically a library and set of utilities that sits on top of stock JS to accomplish many common patterns in Javascript. It is widely used in the web development industry and allows you to avoid using a lot of boilerplate code and makes more complex animation and AJAX trivial. Here's a link to the API docs.
From what it sounds like, you have a large image that you want to shrink with animation and then redirect the browser to another page. Without seeing your code exactly or knowing your specific use case, it is difficult to provide a lot of help, but I'll try. It would be helpful if you uploaded it. Use the Code:
.click()Code:
.animate()Code:
window.open("URL")Code:
window.location.href("URL")I hope that answers your question, but again, it's tough to give specific feedback without the code you already have. Good luck with your website! |
Re: Code Help
If Isaac's jQuery info works for you, that's fine. Considering you have an image map, here's some simplified skeleton code:
Code:
This code uses the .animate() function from jquery's libraries, so you will need to download the libraries for use: jquery.com . If there's still confusion or there's a mistake (which I make a lot), again, please clarify. Good luck on your website. |
Re: Code Help
Code:
<!doctype=html>The only issue that I can see with that is wierd reloads that defeat the purpose of it...or should I just combine my whole site into one page, and have that change states on it? |
Re: Code Help
I'm getting the idea that you want the hexagon map to shrink and a loading animation to happen. Then once the content is loaded, expand and have content in it?
If so it's called a page loading effect. Codrops just did a tutorial on them with some great examples. |
| All times are GMT -5. The time now is 15:48. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi