Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Image Slider/Nav

Featured Replies

Could anyone point me in the direction of a menu (probably javascript?) that changes a main image when the menu items are hovered over and goes to a link when clicked?

 

I would like the nav menu on the right hand side that changes the image shown in the left side on rollover. I'd like to be able to have either rollover images for the nav items, or just use css to display a different background image on hover/active.

 

51155753.jpg

 

Thanks

Edited by ffmedia

Could anyone point me in the direction of a menu (probably javascript?) that changes a main image when the menu items are hovered over and goes to a link when clicked?

 

I would like the nav menu on the right hand side that changes the image shown in the left side on rollover. I'd like to be able to have either rollover images for the nav items, or just use css to display a different background image on hover/active.

 

51155753.jpg

 

Thanks

 

 

This is easy, You need to include the jquery lib into your webpage.

 

The script

$(document).ready(function() {

    //First image
    $('#link1').click(function() {
      $('#div').fadeIn(300);
      $('#div').html('<img src="image1.png" alt="">');
    }

    //Second image
    $('#link2').click(function() {
      $('#div').fadeIn(300);
      $('#div').html('<img src="image2.png" alt="">');
    }
}

 

Display Window:

<div id="div"></div>

 

Menu Button:

<a id="link1" href="#">Link 1</a>
<a id="link2" href="#">Link 2</a>

 

This has not been tested but should change the background image of the div onlick

  • Author

Thanks Shaun,

 

I would like the main div content to change when the menu items are hovered over, is it as straightforward as changing .click to .hover?

 

$(document).ready(function() {

    //First image
    $('#link1').click(function() {
      $('#div').fadeIn(300);
      $('#div').html('<img src="image1.png" alt="">');
    }

 

to

 

$(document).ready(function() {

    //First image
    $('#link1').hover(function() {
      $('#div').fadeIn(300);
      $('#div').html('<img src="image1.png" alt="">');
    }

 

Then would I just include an href link to the new page so it goes to that page when the menu item is clicked?

 

 <a id="link1" href="contact_page.html">Link 1</a>

 

Thanks

Thanks Shaun,

 

I would like the main div content to change when the menu items are hovered over, is it as straightforward as changing .click to .hover?

 

$(document).ready(function() {

    //First image
    $('#link1').click(function() {
      $('#div').fadeIn(300);
      $('#div').html('<img src="image1.png" alt="">');
    }

 

to

 

$(document).ready(function() {

    //First image
    $('#link1').hover(function() {
      $('#div').fadeIn(300);
      $('#div').html('<img src="image1.png" alt="">');
    }

 

Then would I just include an href link to the new page so it goes to that page when the menu item is clicked?

 

 <a id="link1" href="contact_page.html">Link 1</a>

 

Thanks

 

Yes you can do this :)

  • Author

I have tried using the script but cannot get it to work. I have applied CSS to #div so make sure it is correctly positioned and large enough to show the images.

 

Dreamweaver shows a syntax error in

  $('#link2').hover(function() {

but i can't see the problem. Also how do I change it so it changes the main image on hover rather than click. Just changing it from .click to .hover doesn't seem to do anything.

 

<script src="js/jquery-1.5.js"></script>
<script>
$(document).ready(function() {

    //First image
    $('#link1').hover(function() {
      $('#div').fadeIn(300);
      $('#div').html('<img src="images/viewer.png" alt="">');
    }

    //Second image
    $('#link2').hover(function() {
      $('#div').fadeIn(300);
      $('#div').html('<img src="images/btn_down.jpg" alt="">');
    }
}
</script>

 

Thanks

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.