small bug fixed for auto scroll

This commit is contained in:
Harry Bomrah 2015-10-18 02:30:13 +08:00
parent a87df693bf
commit e8b90639c6
1 changed files with 17 additions and 15 deletions

View File

@ -229,21 +229,23 @@ $(document).ready(function(){
if(window.location.hash != ""){ if(window.location.hash != ""){
var item = window.location.hash.replace("#",""); var item = window.location.hash.replace("#","");
el = $("div[data-scroll-id=" + item + "]"); el = $("div[data-scroll-id=" + item + "]");
$('html, body').scrollTop(el.offset().top - 100); if(el.length > 0){
el.addClass("scroll-element"); $('html, body').scrollTop(el.offset().top - 100);
$.ajax({ el.addClass("scroll-element");
url : "/admin/comments/read", $.ajax({
dataType : "json", url : "/admin/comments/read",
type : "post", dataType : "json",
data : {"response_id" : item.split("_")[1]} type : "post",
}).done(function(data){ data : {"response_id" : item.split("_")[1]}
if(data.success){ }).done(function(data){
el.find("img[data-avatar-id="+ data.user_id +"]").addClass("read"); if(data.success){
} el.find("img[data-avatar-id="+ data.user_id +"]").addClass("read");
}) }
el.one("mouseover",function(){ })
el.css('border-color', 'transparent'); el.one("mouseover",function(){
}) el.css('border-color', 'transparent');
})
}
} }
$(".member_tags").select2({ $(".member_tags").select2({