Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I am having a requirement as follows,
1.I need to play Youtube videos( 10 or more videos in a sequence) one after another automatically using some javascript control.
2.The User should be able to slide to next or previous video using slider buttons.
3.If the current video ends up, the control should be able to pick next video and play it automatically. I dont want this to happen with the help of any server controls in asp.net or ajax. But, would like to use only javascript and html elements or jquery if possible.
Can any one please suggest any links or useful information about javascript control to make this happen.
Any help is appreciated!! Thanks.
You just need to create normal slider, but add few functions to it's controls. Let's say, clicking on next, will stop current video, move slide to another and turn on new video. Everything is accessible through YouTube API: https://developers.google.com/youtube/js_api_reference.
You can write your own slider or just choose of some written already:
http://www.menucool.com/video-slider
http://www.woothemes.com/flexslider/
http://www.slidesjs.com/
http://wowslider.com/
what you are searching for may be the "player.cuePlaylist" API function from Youtube. Read the "YouTube JavaScript Player API Reference": https://developers.google.com/youtube/js_api_reference?hl=zh-TW
Also note that recently Youtube changed the usage of it's API. You need to put your code on a webserver in order to function, because all calls from localhost are blocked.
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
To start off, here's a picture of the website project:
http://i.imgur.com/FbdUmpp.png
The top image is one of the cycling images in the website banner. I'd like to make my website a bit more polished. When the user navigates to a new webpage, the banner animation will restart. I was wondering how I could stop this from happening.
How can I keep the banner from restarting when a user switches a
webpage?
What's the exact name of what I'm trying to accomplish? (I can't seem to find any information about this subject.)
My knowledge is limited to HTML, CSS, a little bit of PHP and JavaScript. I don't mind learning a new language in order to achieve this.
Thanks in advance!
Well the animation restart is due to the content being reloaded when you land on the new page. There is no way around that specifically. However you can change the content on the screen without actually navigating away. Look into AJAX to accomplish this. Have an AJAX call get the new data that you want to view and place it on the current screen in place of the old data. This way you will still get the new information and the animation of the banner will continue without stops or restarting.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a book, tool, software library, tutorial or other off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 8 years ago.
Improve this question
I'm working on a long scrolling website that features a number of full background hi res images. It's currently taking too long to load since all the images are loaded in parallel by default.
So before I custom write something to load first what comes first and later what comes later (this way the first scroll will load almost instantly and the user will wait for the remaining part while reading the first part :P), is there any script that will do this out of the box?
I'm thinking on some existing code that will read each img tag or background-image property/style-attribute and load the images sequentially depending on their appearance on HTML or a some extra attribute.
I prefer vanilla JS or jQuery. If I can't find it, I'll write a plugin myself, votes/encourages accepted!
I would try using a plugin like LazyLoad:
http://www.appelsiini.net/projects/lazyload
There is a threshold value that will start to load images a certain number of pixels off screen. That way as visitors start scrolling down, it'll begin loading the next few sections.
I created a jQuery plugin to achieve this. Check it out! It's a work in progress so you're welcome to comment and suggest! I took a lot from Lazy Load.
https://github.com/mspivak/sequencial_load
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
Hey :) I have this video and I want the controls to be outside the player; something like this:
Click to see Image
Is there a cross-browser way to do this? Even if I have to create custom controls (What would be perfectly fine)?
This is my first question here, so sorry if I'm not being specific enough.
Use a premade video player script such as this one: http://www.videojs.com/ - many customization options are available.
Usually, the most straightforward way you would do this is by removing the controls attribute of the video tag, and then writing the controls as separate HTML elements, which are hooked up via JavaScript to play/pause/navigate the video. This will mean the video box area will have no controls of its own, so users will be dependent on the outside controls. (However, note that given correct CSS styling, they don't have to be located outside)
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I would like to know how (if even possible) to keep my javascript running after i've continued to the next page.
My situation:
Javascript clicks next button.
I'm now on a new page.
But the javascript stops running and all my functions/variables are gone.
I want to be able to push the button with javascript and then continue running the code that comes after that .click() part.
If its not possible can you maybe suggest a way to do this programmaticly?
No.
Once you leave the page, any JavaScript running on that page will also stop running.
You have two options.
Store any variables or settings you need using cookies, and continue running the same script on the next page.
Don't actually leave the page. You can use AJAX to load new information on the page, or perhaps change part of the page content using an IFRAME while the host page continues to load.
As #mike-edwards has said in the comments, you need a single page app.
You can use frameworks like AngularJS or Knockout.js to make your life easier.
As you said, whenever a new page loads in the browser, all your variables etc from the previous page will be lost. The only way to preserve your variables is to not change the page. You can do this using these frameworks and the HTML5 History infrastructure.
With AngularJS, history support comes out of the box. As far as I know, Knockout.js does not have history API support so you would need to use another JS plug-in like Davis.js for that.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I want to use 2 different open source plugins for my website, a gallery and a calendar, both uses JQuery to work.
But when i put both of their javascript together in my website, it clashes and only one will be able to appear.
Is there any ways to specific if that javascript file just works for one DIV only? Or any work around to have both in my website.
Is there any ways to specific if that javascript file just works for one DIV only?
No, there is a single execution environment for a given HTML document. The only way to sandbox JavaScript is to put it in an iframe (even then, there are APIs that allow other documents to be affected)
Or any work around to have both in my website.
Edit the source of the respective scripts to change which elements they affect and to make them use the same version of jQuery and any other libraries they might depend on.