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.

jQuery help please :)

Featured Replies

Hey,

 

I'll keep the story short.

 

I have 3 images that are used as buttons;

 

<input type="image" src="images/Ps.jpg" id="psbutton" alt="Photoshop" style="width:45px; height:35px; margin-right:5px;"/>
<input type="image" src="images/Dw.jpg" id="dwbutton" alt="Dreamweaver" style="width:45px; height:35px; margin-right:5px;"/>
<input type="image" src="images/Ai.jpg" id="aibutton" alt="Illustrator" style="width:45px; height:35px; margin-right:5px;"/>

 

On the page, I want 3 big boxes to appear depending on which button is clicked (I can do that using the fadeIn/fadeOut methods).

 

However the problem I am having is this;

 

In one of the boxes I have loads of images which have the "lightbox2" feature on them all. When I implement the box fadeIn/fadeOut depending on what button is clicked, the lightbox just stops working and loads the image on a new window. In my head I have this:

 

<script type="text/javascript" src="prototype.js"></script>
<script type="text/javascript" src="scriptaculous.js?load=effects,builder"></script>
<script type="text/javascript" src="lightbox.js"></script>

<script type="text/javascript">
$(document).ready(function () { 
       $('#psbutton').click(function() {

               $('#pscontainer').fadeIn('slow');
			$('#dwcontainer').fadeOut('slow');
			$('#aicontainer').fadeOut('slow');
       });

	$('#dwbutton').click(function() {

			$('#pscontainer').fadeOut('slow');
			$('#dwcontainer').fadeIn('slow');
			$('#aicontainer').fadeOut('slow');
	});

	$('#aibutton').click(function() {
			$('#pscontainer').fadeOut('slow');
			$('#dwcontainer').fadeOut('slow');
			$('#aicontainer').fadeIn('slow');
	});

});


</script>

 

However to get the jQuery working, I need to put in a link to the libary:

 

<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>

 

So, now my box swapping works but the lightbox doesnt with this code in the head;

 

<script type="text/javascript" src="prototype.js"></script>
<script type="text/javascript" src="scriptaculous.js?load=effects,builder"></script>
<script type="text/javascript" src="lightbox.js"></script>
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>
<script type="text/javascript">
$(document).ready(function () { 
       $('#psbutton').click(function() {

               $('#pscontainer').fadeIn('slow');
			$('#dwcontainer').fadeOut('slow');
			$('#aicontainer').fadeOut('slow');
       });

	$('#dwbutton').click(function() {

			$('#pscontainer').fadeOut('slow');
			$('#dwcontainer').fadeIn('slow');
			$('#aicontainer').fadeOut('slow');
	});

	$('#aibutton').click(function() {
			$('#pscontainer').fadeOut('slow');
			$('#dwcontainer').fadeOut('slow');
			$('#aicontainer').fadeIn('slow');
	});

});


</script>

 

Any help, im pretty confused here!

 

 

[/code]

  • Author

Okay after some googling it seems that this was a common problem!

 

jQuery.noConflict();

 

Is placed at the start of the script, then all $ are replaced with jQuery

 

Simples :)

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.