Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 6 years ago.
Improve this question
Im applying a fade in when a user mouseover a element, but is not working, here is my code line:
$(this.svgElement).on('mouseover', '.' + jsTagClass, $.proxy(this.onTagClick, this)).fadeIn(2000);
Use the fadeIn in the callback function of your mouseover event listener like this:
$(this.svgElement).on('mouseover', '.' + jsTagClass, function() {
$(this).fadeIn(2000);
});
If the given variables have the right values, this will work.
Related
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 5 years ago.
Improve this question
function change_width() {
$('#cont').toggle(function(){
$('#cont').animate({marginLeft:'0%'});
},function(){
$('#cont').animate({marginLeft:'18.4%'});
});
}
I have the following code here, and it should work but it doesn't. Instead it's affecting the display attribute, making it display: none. Why is it doing this?
Since toggle(function, function) is deprecated a simple way is toggle a class and check for that class
function change_width() {
var $cont = $('#cont');
$cont.animate({
marginLeft: $cont.hasClass('inset') ? '0%' : '18.4%'
}).toggleClass('inset');
}
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
For some strange reason this simple click function I've added, which should be adding the 'big' class to the clicked divs, is only working for every other div.
See an example here (click the square boxes with images)
$('.box').click(function(){
$(this).toggleClass('big').siblings().removeClass('big');
});
Here is a fiddle but I chose not to post this as it works fine as it should do. The error is caused by some other element but I don't know what
http://jsfiddle.net/Ly1bxswq/1/
You binding your click handler within a loop, but need to do it only once when all elements added to page.
$.each(data.feed.entry, function (i, entry) {
// ...
$container.append(item);
// ...
})
$('.box').click(function(){
$(this).toggleClass('big').siblings().removeClass('big');
}
As pointed out by #Yan Brunet's comment, it would be much better to delegate the event from every .box to their parent. That way you can bind your handler at any point (even before .box elements are added to page)
$container.on("click", ".box", function(){
$(this).toggleClass('big').siblings().removeClass('big');
});
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 8 years ago.
Improve this question
I have few select withs the same class, I want to manipulate the changed select.
I tried:
$(".test_suite").change(function (event) {
val = $(this).val()
});
but the this work only on the first select.
maybe each will resolved the issue?
any assist will help :)
thanks,
Cfir.
It works for me: http://jsfiddle.net/wy907kbp/4/
$('.test_suite').on('change', function (event) {
console.log($(this).val());
});
You said that want to modify selected value, which you need to explain more.
$(".test_suite").change(function (event) {
val = $(event.target).val()
});
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'm new at javascript and jQuery and I want to use one of those to change my background body images with onclick. Exactly what I want is to create a link with an image so when the people click on it the background body pic will change. Can you help me or give me a simple example.
HTML
<img src="/path/to/image.jpg">Select Image
Javascript
$(document).on('click', 'a.set-background', function(){
$('body').css({
'background' : 'url(' + $(this).find('img').attr('src') + ')'
});
return false;
});
HTML:
<button>Change background</button>
jQuery:
$('button').click(function(){
$('body').css('background-image','image.jpg');
});
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 9 years ago.
Improve this question
http://jsfiddle.net/PF8nL/1/
Using the code in the above jsfiddle I am unable to unhide and hide a row using jQuery. According to this stack answer it seems I am doing this correctly.
Do I have some stupid error? possibly causing this?
Code:
$('input[name="custom_rejection_option"]').click(function() {
$('.custom_reject_area').toggle(this.checked);
}};
You had a syntax error
$('input[name="custom_rejection_option"]').click(function () {
$('.custom_reject_area').toggle(this.checked);
});
//You had `}` instead of the closing `)`
You just had some typos and things.
$('input[name=custom_rejection_option]').click(function() {
$('.custom_reject_area').toggle(this.checked);
});
http://jsfiddle.net/PF8nL/5/