Jump to content

Recommended Posts

Hi all, I'm a complete javascript philistine.  I need help implementing a very simple function to an existing jquery plugin I added on my website. It's basically a content slider that has the option of starting automatically and stopping when you click on either the arrows or on the breadcrumb dots at the bottom.  I'm pretty sure the code I need to apply is this

 

.click(function() {
				// Disable auto change on click
				if (myInterval)
				{
					if (options.stoponclick) { pause_loop = true; }
					clearInterval(myInterval);
				}

 

I would like to make it so that when you click the '.showcase' division it runs that script, can anybody help me?  I've tried a couple of different things, but they clearly did not work...  The whole point, is that I want the slider to stop sliding when you click anywhere (not just the arrows, or breadcrumbs,) so that if you clicked to watch one of the videos, it won't slide to the next slide.

 

This is the code that the plugin uses for the arrows.  Now I just need to create a script that also does it for the '.showcase' div but that doesn't create a showcase div (it's already created.

 

// Left arrow
		jQuery(document.createElement('div'))
			.addClass('showcase-arrow-previous')
			.prependTo(showcase)
			.click(function() {
				// Disable auto change on click
				if (myInterval)
				{
					if (options.stoponclick) { pause_loop = true; }
					clearInterval(myInterval);
				}
				changeContent((current_id === 0) ? content_count-1 : parseInt(current_id)-1, 'previous');
			});
		// Right arrow
		jQuery(document.createElement('div'))
			.addClass('showcase-arrow-next')
			.prependTo(showcase)
			.click(function() {
				// Disable auto change on click
				if (myInterval)
				{
					if (options.stoponclick) { pause_loop = true; }
					clearInterval(myInterval);
				}
				changeContent(current_id+1, 'next');
			});

 

 

 

Here is the page I'm trying to get to work properly.. http://andreimatorin.com THANK YOU!!!

 

Link to comment
https://forums.phpfreaks.com/topic/253617-simple-javascript-help/
Share on other sites

I tried adding

 

$('.showcase').click(function() {
					if (options.stoponclick) { pause_loop = true; }
					clearInterval(myInterval);
				});

 

after the function that calls the plugin script in my header (but still within the documentready function and it didn't do anything...

Whatever I do, is this an acceptable way of adding the modification to the code? or do I have to modify the original js file?

 

<script type="text/javascript" src="<?php bloginfo('stylesheet_directory') ?>/js/jquery.aw-showcase/jquery.aw-showcase.js"></script>
<script type="text/javascript">

$(document).ready(function()
{
$("#showcase").awShowcase();
	//Add stop on click event for .showcase div


	$('.showcase-content').click(function() {
	     clearInterval(myInterval);
	});

});



</script>

 

 

This is the full code of the .js file http://www.andreimatorin.com/wordpress/wp-content/themes/2012_theme/js/jquery.aw-showcase/jquery.aw-showcase.js

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.