Shanmugaraja K Shanmugaraja K - 6 months ago 15
jQuery Question

hide function parameters not working in jquery

I'm using

show
function in my script. i m also passing parameters in that function, but it showing error. im using below code, while click a button i call this next() function.

function next() {
$('#img1').hide('slide', { direction: 'left' }, 1400);
}


this is not worked for me. showing this error
Uncaught TypeError: n.easing[this.easing] is not a function
. while passing without parameters it works fine.

Answer

Use this code

$("button").click(function(){
    $("div").animate({width:'toggle'}, 350);
});
div {
    width: 100px;
    height: 100px;
    background: green;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<button>Show/hide</button>
<br/><br/>
<div></div>