Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tab action for external link #171

Open
kosheen1 opened this issue Mar 6, 2018 · 11 comments
Open

Tab action for external link #171

kosheen1 opened this issue Mar 6, 2018 · 11 comments

Comments

@kosheen1
Copy link

kosheen1 commented Mar 6, 2018

Hi there, i was wondering what action should i put to get a list to slide the content just like the tab do

like onclick="liquidSlider.setPanel(2)" or any other way

@KevinBatdorf
Copy link
Owner

Hi,

You can store the functions into a variable then call them from anywhere

$('#slideshow').liquidSlider();

var api = $.data( $('#slideshow')[0], 'liquidSlider');
$('.list').on('click', function() {
    api.setPanel(2);
});

@kosheen1
Copy link
Author

kosheen1 commented Mar 6, 2018

Still not make the link to slide it... maybe im missing something somewhere. Heres the actual part of the list

<div class="mySlides">
     <div class="ListItem"> <a href="#1" class="active">Something</div>
     <div class="ListItem"> <a href="#2">Another Thing</a></div>
     <div class="ListItem"> <a href="#3">One more for the Sake!</a></div>
</div>

mySlides is a simple slide everything works fine except this little part

@KevinBatdorf
Copy link
Owner

Use the code I have above and adapt it to your markup.

$('.list').on('click' ... would require you to change .list to .ListItem a

@KevinBatdorf
Copy link
Owner

You would also have to get the href then split the # from it.

@kosheen1
Copy link
Author

kosheen1 commented Mar 6, 2018

Yes i did change the class to the appropriate one. And i have no clue what the href thing you meant. From the code you gave me i would assume(if working) that any item in the list i click would return to the value 2 while they should have their own slide panel

Im really lost right now to be honest

@KevinBatdorf
Copy link
Owner

Can you post the javascript you have?

href as in <a href="#2">

You have to figure out how to extract that number, then use it in the code I pasted above api.setPanel(2);

@kosheen1
Copy link
Author

kosheen1 commented Mar 6, 2018

<script>

var api = $.data( $('#main-slider')[0], 'liquidSlider');

$('#main-slider').liquidSlider({
dynamicTabs: true,
dynamicTabsHtml: true,
includeTitle: true,
panelTitleSelector: '.Title',
dynamicTabsAlign: 'left',
dynamicTabsPosition: 'top',
navElementTag: 'div',
hashLinking: true,
continuous: false, 
hashTitleSelector: '.Title',
  autoHeight:false,
  slideEaseFunction:'animate.css',
  slideEaseDuration:1000,
  heightEaseDuration:1000,
  animateIn:"bounceIn",
  animateOut:"bounceOut",
  callback: function() {
    var self = this;
    $('.Title').each(function() {
      $(this).removeClass('animated ' + self.options.animateIn);
    });
  }
});

$('.ListItem a').on('click', function() {
    api.setPanel(2);
});
  </script>

@kosheen1
Copy link
Author

kosheen1 commented Mar 6, 2018

I can use this to get the link info but how to integrate it to your existing code...

$(document).ready(function() {
            $("a").click(function(event) {
                alert("As you can see, the link no longer took you to jquery.com");
                var href = $('a').attr('href');
                alert(href);
                event.preventDefault();
            });
        });

@KevinBatdorf
Copy link
Owner

You cant store the functions if the slideshow doesn't exist yet. Just move the var api... section above the click event

@kosheen1
Copy link
Author

kosheen1 commented Mar 6, 2018

gemme a sec im gonna try something

@kosheen1
Copy link
Author

kosheen1 commented Mar 6, 2018

Tryed this didnt work either

var api = $.data( $('#main-slider')[0], 'liquidSlider');
$('.ListItem a[data-slide]').click(function(e){
api.setPanel( $(this).data() );

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants