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 2 years ago.
Improve this question
When I play a sound with js, I just want the sound coming from the right. how can I do that
Yes. Check out StereoPannerNode from the Web Audio API.
The pan property takes a unitless value between -1 (full left pan) and
1 (full right pan). This interface was introduced as a much simpler
way to apply a simple panning effect than having to use a full
PannerNode.
Also see this example: https://developer.mozilla.org/en-US/docs/Web/API/Web_Audio_API/Using_Web_Audio_API#Adding_stereo_panning_to_our_app:
const pannerOptions = { pan: 0 };
const panner = new StereoPannerNode(audioContext, pannerOptions);
<input type="range" id="panner" min="-1" max="1" value="0" step="0.01">
const pannerControl = document.querySelector('#panner');
pannerControl.addEventListener('input', function() {
panner.pan.value = this.value;
}, false);
track.connect(gainNode).connect(panner).connect(audioContext.destination);
(Note: this isn't specific to Vue)
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 4 days ago.
Improve this question
I'm Having difficulties creating a slider with 3 different images.
I have a problem selecting the previous image when clicking on previous button in the slider.
Here is my javascript code
let images=['dice-1.png','dice-2.png','dice-3.png'];
var i =0;
function slideShow() {
document.getElementById("image").src=images[i];
if(i<images.length-1){
i++;
}
else {
i=0;
}
}
function prevSlide(){
document.getElementById("image").src=images[i];
if(i>images.length-1){
i--;
}
}
document.querySelector('.nxt').addEventListener('click', slideShow);
document.querySelector('.pr').addEventListener('click', prevSlide);
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 10 months ago.
Improve this question
This is the code if you want to try it out:
https://jsfiddle.net/csCoder/eLxfrn10/8/
I currently have 2 textboxes from the user will type in their input and when they press "draw line", then the input is read and a line is drawn accordingly. I want to make it so that the line will automatically be drawn whenever the user inputs anything in the textbox (without having to click on a button) OR whenever the user uses the slider.
Currently the lines that I drew changed based on what is typed into the textbox. However, I have a slider that updates the text box and I want my program to keep track of the slider AND the textboxes instead of just the textboxes if that makes sense. I appreciate your help!
This is what it looks like right now:
Picture
I cleaned up the code to make it easier and more relevant:
This code snippet represents the slider and the textbox (user should be able to use either to input numbers).
<input id="rangeInputM" type="range" min="-10" max="10" oninput="m1.value=rangeInputM.value" />
<input id="m1" type="number" value="1" min="-200" max="200" oninput="rangeInputM.value=m1.value" />
This is where I am having trouble getting my drawing to update whenever I either input new text or move the slider. Using #m1 as the selector works for updating the text box, but I am trying to get both the textbox (#m1) and the slider (#rangeInputM) to work:
$("#rangeInputM").keyup(function(){
var m1,b1 = 0;
m1 = parseFloat($("#m1").val());
b1 = parseFloat($("#b1").val());
var myGraph = new Graph({
canvasId: 'Graph',
minX: -10,
minY: -10,
maxX: 10,
maxY: 10,
unitsPerTick: 1
});
myGraph.drawLine(m1, b1, 'blue', 3);
});
Thanks!
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 1 year ago.
Improve this question
I have question. Is there any way for html or javascript?
I have adf.ly referral link(example): adf.ly/12345 + link.
To download my source download file1 i input link as: adf.ly/12345/https://example.com/downloadfile1
For file2 link i input adf.ly/12345/https://example.com/downloadfile2
.. and so on for many links.
But one day I need to change my referral link from adf.ly/12345 to adf.ly/6789
So i need to change above link one by one:
adf.ly/6789/https://example.com/downloadfile1
adf.ly/6789/https://example.com/downloadfile2
.. and so on.
My question, is there any way to auto change any link start from adf.ly/12345+url to adf.ly/6789+link, using html or JavaScript?
I try to search the topic, but I'm just beginner. I cant find any or maybe wrong search.
Suppose you are using two input tags, first to get input for the initial url and in the next input field insert the new url, when clicking the button, it will replace the existing url with the new one everywhere.
function replaceUrl () {
let initial = document.getElementById("initial").value;
let replace = document.getElementById("replace").value;
let url = ['shorte.st/abc123/https://example.com/downloadfile2', 'adf.ly/12345/https://example.com/downloadfile2']
url = url.map((u) => u.includes(initial) ? u.replace(initial, replace) : u)
console.log(url)
}
Enter first part <input type="text" id="initial"/>
Enter second part <input type="text" id="replace"/>
<input type="button" value="Change" onclick="replaceUrl()">
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 3 years ago.
Improve this question
i Have Two Question About Bootstarp Slider
First How can I use change event in BootstrapSlider and get value
and Second is how to change initial value of bootstrap slider
You can use .on('chnage', callback_function) to listen to value changes
and set the data-slider-value=< any number > to initialize the starting value
<input
type="text"
name="somename"
data-slider-value="20"
data-provide="slider"
data-slider-min="1"
data-slider-max="100"
data-slider-step="1"
data-slider-tooltip="hide"
>
// Instantiate a slider
var mySlider = $("input").slider();
//This will get called for every chnage
mySlider.on('change',function(){
//getting value from slider
var value = mySlider.slider('getValue');
console.log(value)
})
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 5 years ago.
Improve this question
I am working in MVC C#. I have a table with Enum values. I got 2 conditions in Enum as On and Off. I want my text box to be Enabled during On and Disabled during Off. How to do this ? kindly help.
My text box as follows:
<div ><p class="form_text1">Start</p> <input type="text" id="EditStart" name="EditStart" class="form-control">
</div>
If you want a bit more of a generic approach, you can do this through C# instead of JavaScript. However, I am unsure how you are getting this enum so my answer might not work. Hope this helps.
public static MvcHtmlString EnumTextBox(this HtmlHelper<TModel> htmlHelper,
YourEnum enum)
{
object attributes = null;
if(enum == YourEnum.Off)
{
attributes = new
{
disabled = "disabled"
};
}
return htmlHelper.TextBox("YourTextBoxName", null, attributes);
}
Note: I did not test this, just wrote it out from head.