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

Autoplay doesn't work #88

Open
MarbleDaemon opened this issue Aug 19, 2016 · 14 comments
Open

Autoplay doesn't work #88

MarbleDaemon opened this issue Aug 19, 2016 · 14 comments

Comments

@MarbleDaemon
Copy link

Hello,

I initialized the slider with autoplay: true but it doesn't play automatically.

@forestkelley
Copy link

I think auto play in this plug-in simply means when play is pressed, that it will rotate, not that it will rotate on page load. I'd also like to have it rotate on page load.

@carlmcf
Copy link

carlmcf commented Sep 16, 2016

Is not working for me either. I need it anyway, so I did a .play() to the three sixty viewer when the document is ready. Is not the best solution and practice, but it works... :/

@forestkelley
Copy link

forestkelley commented Oct 26, 2016

@carlmcf can you share your code? I'm not sure how to use .play() to initiate autoplay of the three sixty viewer when the document is ready. I've tried a few things, but no luck. Thanks!

@MarbleDaemon
Copy link
Author

MarbleDaemon commented Oct 26, 2016

It is as simple as:

var element = $(<YOUR SPINNER HERE>).ThreeSixty({ onReady: function(){ element.play(); }, ... });

@forestkelley
Copy link

forestkelley commented Oct 27, 2016

Sorry to be so novice, but @MarbleDaemon, I can't get your code to work. Here's the body of my index file. I've tried a few variations of your original snippet and your edited one, replacing "product1" with "product" and "product.play();" with "car.play();" and so on. I placed your snipped at the bottom of the body. I also wasn't sure why you included "...". I suspect I'm supposed to inject some of my code there, but it's over my head. Thanks in advance!

`

<section class="container-fluid" id="container">
  <div class="threesixty product1">
    <div class="spinner">
      <span>0%</span>
    </div>
    <ol class="threesixty_images"></ol>
  </div>
  <a class="btn-threesixty btn-threesixty-previous custom_previous"></a>
  <a class="btn-threesixty btn-threesixty-play custom_play"></a>
  <a class="btn-threesixty btn-threesixty-pause custom_stop"></a>
  <a class="btn-threesixty btn-threesixty-next custom_next"></a>
</section>

<script src="js/jquery-1.8.3.min.js"></script>
<script type="text/javascript" src='js/threesixty.js'></script>

<script type="text/javascript">
window.onload = init;

var product;
function init(){

    car = $('.product1').ThreeSixty({
    totalFrames: 72,
    endFrame: 72,
    currentFrame: 1,

    imgList: '.threesixty_images',
    progress: '.spinner',
    imagePath:'images/car/',
    filePrefix: '',
    ext: '.jpg',
    height: 1620,
    width: 1080,
    navigation: true,
    disableSpin: true,
    responsive: true
  });

  $('.custom_previous').bind('click', function(e) {
    car.previous();
  });

  $('.custom_next').bind('click', function(e) {
    car.next();
  });

  $('.custom_play').bind('click', function(e) {
    car.play();
  });

  $('.custom_stop').bind('click', function(e) {
    car.stop();
  });
}
</script>
 <script type="text/javascript">
   $('.product1').ThreeSixty({
    onReady: function(){
    product.play();
    },
    });
</script>
`

@MarbleDaemon
Copy link
Author

MarbleDaemon commented Oct 27, 2016

it should be

<script type="text/javascript"> var product = $('.product1').ThreeSixty({ onReady: function(){ product.play(); }, }); </script>

In the car case, replace product with car.

@forestkelley
Copy link

@MarbleDaemon It's still not working. I tried this also: <script type="text/javascript"> var product = $('.product1').ThreeSixty({ onReady: function(){ car.play(); }, }); </script>

@MarbleDaemon
Copy link
Author

<script type="text/javascript"> var car= $('.product1').ThreeSixty({ onReady: function(){ car.play(); }, }); </script>

@forestkelley
Copy link

@MarbleDaemon It's not working either way. Here's a link: http://forestkelley.net/_TEST/threesixtytest/index.html

@MarbleDaemon
Copy link
Author

Please check if your 360 is car or product and call it appropriately.

@forestkelley
Copy link

forestkelley commented Oct 27, 2016

I'm not sure, but I've tried both. Here is the code from which all of these show:

var product; function init(){ car = $('.product1').ThreeSixty({

@MarbleDaemon
Copy link
Author

Also, why do you call .ThreeSixty twice?

On Thu, Oct 27, 2016 at 9:48 PM, forestkelley [email protected]
wrote:

I'm not sure, but I've tried both. Here is the code from which all of
these show:

`var product;
function init(){

car = $('.product1').ThreeSixty({`


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#88 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AEkqxMs1f2mZpV4TXBS_WAE3p94bToPIks5q4LnOgaJpZM4JoLfs
.

@forestkelley
Copy link

Got it working! @MarbleDaemon, asking why I was calling ".ThreeSixty" twice was a good clue. Instead of adding your code separately, I injected it below the plug-in's original call to .ThreeSixty. Here's the working script:

window.onload = init; var product; function init(){ car = $('.product1').ThreeSixty({ onReady: function(){ car.play(); }

@MarbleDaemon
Copy link
Author

I'm glad it works for you :)

On Thu, Oct 27, 2016 at 10:59 PM, forestkelley [email protected]
wrote:

Got it working! @MarbleDaemon https://github.com/MarbleDaemon, asking
why I was calling ".ThreeSixty" twice was a good clue. Instead of adding
your code separately, I injected it below the plug-in's original call to
.ThreeSixty. Here's the working script:

window.onload = init;
var product;
function init(){
car = $('.product1').ThreeSixty({
onReady: function(){
car.play();
}


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#88 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AEkqxE4dTsGC2WBwWI0b7iMu7uyQXDrGks5q4MpXgaJpZM4JoLfs
.

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

3 participants