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');
}
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 2 years ago.
Improve this question
how to move a "li" tag into another "UL" tag without removing the first "li"?
$(document).ready(function () {
$("#id").click(function () {
$("#id li").last().replace('#id li');
});
});
also I use this code but didn't work.
You can use jquerys clone() method to "copy" the element
$(document).ready(function () {
$("#id").click(function () {
$("#id li").last().clone().appendTo('.anotherElement')
});
});
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 a problem with javascript on Wordpress!
I have to insert in my theme this pen https://codepen.io/z-/pen/OBPJKK .
HTML and css work, the only problem to fix is with javascript.
I replaced "$" in the original JS with "jQuery" and I entered this script in Theme Option> Advanced > Code Fields > Space Before head area:
<script type="text/javascript">
jQuery(document).ready(function() {
jQuery('.single .fusion-post-slideshow li img').each(function() {
var caption = jQuery(this).attr('alt');
jQuery(this).after('<span>' + caption + '</span>');
});
});
</script>
The problem lies in the inability to reproduce the onclick effect of the aforementioned pen.
When going to the url of the page http://www.goatsplan.com/goats-magazine/, Wordpress seems not to recognize JS, and it is as if no code has been entered. Please, how can I solve this problem and keep the same type of animation in javascript?
Thank you very much
jQuery(".option").click(function(){
jQuery(".option").removeClass("active");
jQuery(this).addClass("active");
});
Just past the above jQuery in the Footer file/Template
Its working fine--> https://prnt.sc/r04jfi
https://prnt.sc/r04jug
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.
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.
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/