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.

active class on jQuery slider

Featured Replies

Hi guys,

 

Having a few problems getting the first active button to work on this jquery slider:

 

http://www.blendagency.co.uk/portfolio/index.html

 

The active button starts to work after the first slide, but I want it to work on the first slide - any ideas?

 

JS file here: http://www.blendagency.co.uk/js/jquery.lite-content-slider.js

 

Thanks in advacne!

 

Manually add this class '.btnactive' to the first link.

 

<div id="sliderButtons">
<!-- change this: -->
	<a class="buttons bt1" href="#" rel="1"> </a>
<!-- to this: -->
	<a class="buttons bt1 btnactive" href="#" rel="1"> </a>

<a class="buttons bt2" href="#" rel="2"> </a>
<a class="buttons bt3" href="#" rel="3"> </a>
<a class="buttons bt4" href="#" rel="4"> </a>
<a class="buttons bt5" href="#" rel="5"> </a>
</div>

 

Or you can add a line of code into your plugin js file.

 

       return this.each(function(){
		init($(this));

		// Add the following line.
		$('.'+options.buttonsClass+':first').addClass('btnactive');


		$('.'+options.buttonsClass).click(function(e){
			e.preventDefault();
			pauseSlide();
               goToSlide($(this).attr('rel'));
           });

		$(options.controlBt).click(function(e){
			e.preventDefault();
			if(playStatus == true){
				pauseSlide()
			}else{
				playSlide()
			} ;
           });

       });

Edited by PHP Monkey

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.