I have jQuery function in my view.
And variable in my view model:
public bool pageChanged { get; set; }
Function:
$(document).ready(function () {
if (@Model.pageChanged == true) {
$('html, body').animate({
scrollTop: $("#picture_section").offset().top
}, 2000);
}
});
Without if statement it works fine. But if I want to compare bool value of my model it doesn't work. I tried alert("@Model.pageChanged") and it showed right value.
So I tried
if(@Model.pageChanged) {
}
if(@Model.pageChanged == true) {
}
But it didn't work. How could I change the if statement to work? Is there problems with types?
Thank you for solving issue.