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
$beefup.open method doesn't scroll to accordion panel or am i missing a config #10
Comments
Hi @carterax , thx. Please have a look at the https://schascha.github.io/BeefUp/#example-scroll In some circumstances there are missing options in the hashchange event. I will publish a new Release soon. |
i added your commit changes to the source code on my local environment and still not working, instead of using hash to scroll to the accordion i am checking if an ID is present on page load and i was under the impression it would automatically scroll once i use the open method. |
Can you please try this example: <article class="beefup example-scroll" id="example-scroll">
<h4 class="beefup__head">Item</h4>
<div class="beefup__body">Content</div>
</article> var $scroll = $('.example-scroll').beefup({
scroll: true
});
$scroll.open($('#example-scroll')); |
Still now working, here's my code if it helps
|
Maybe Please update your condition in order to be sure the active accordion exists: if(activeSlug.length && $(`#${activeSlug}`).length) {
...
} Example: <!DOCTYPE html>
<html lang="en">
<head>
<title>Test</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://schascha.github.io/BeefUp/dist/css/jquery.beefup.css">
</head>
<body>
<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
<div id="betterfaq__container" class="betterfaq__plugin" data-betterfaq-active-faq="foo">
<article class="beefup" id="foo">
<h2 class="beefup__head">
<a href="#">Item</a>
</h2>
<div class="beefup__body">
Content
</div>
</article>
</div>
<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
<script src="https://schascha.github.io/BeefUp/dist/js/jquery.min.js"></script>
<script src="https://schascha.github.io/BeefUp/dist/js/jquery.beefup.min.js"></script>
<script>
$(function() {
var activeSlug = $('#betterfaq__container').data('betterfaq-active-faq');
var
$betterfaq = $('#betterfaq__container .beefup').beefup({
openSingle: true,
scroll: true,
scrollOffset: -90,
scrollSpeed: 1000
});
// checks if the active slug is set
// opens the specified accordion tab but doesn't scroll to it
if(activeSlug.length && $(`#${activeSlug}`).length) {
$betterfaq.open($(`#${activeSlug}`));
}
});
</script>
</body>
</html> |
@Schascha Thank you so much, as it turns a settimeout function blocked the open method from running. Thank you so much once again. |
Amazing plugin you've got here @Schascha thank you.
I tried opening a panel based on an active ID, it works but it won't scroll to the open accordion.
The text was updated successfully, but these errors were encountered: