我正在创建自定义光标“ trailer”(请参见小提琴:https://jsfiddle.net/alexdlf/hx6yzu4w/)
通常,圆圈(.cursor
)应该跟随光标。将鼠标悬停在红色框(.cl
)上时,圆应移动并坚持到红色框内的微小蓝点(.ct
)。这是由mouseenter
侦听器触发的。但是,如果将光标移到红色框中的速度太慢,则似乎事件没有触发并且效果没有发生(如果光标以正常/更快的速度进入红色框,则效果很好。)
我的实现是否存在问题?还是我缺少mouseenter
的一些基本知识?
答案 0 :(得分:1)
“光标”遮盖了红色框。具有透明的背景并不能防止这种情况。如果您移动鼠标的速度超过了“光标”的保持速度,那么它将“起作用”。
将pointer-events: none
添加到“光标”的CSS中。
答案 1 :(得分:0)
删除class SchoolSelectionOne(models.Model):
student = models.ForeignKey(StudentProfile, on_delete=models.CASCADE, null=True)
name_of_School = models.CharField(max_length=100)
program = models.CharField(max_length=50)
residential_Status = models.CharField(max_length=50, choices=RESIDENTIAL_STATUS_CHOICES
效果。
请参见def placement(request):
profiles = StudentProfile.objects.all()
uploads = StudentResultsUpload.objects.all()
school_one = SchoolSelectionOne.objects.all()
school_two = SchoolSelectionTwo.objects.all()
school_three = SchoolSelectionThree.objects.all()
school_four = SchoolSelectionFour.objects.all()
school_five = SchoolSelectionFive.objects.all()
profile_dicts = []
for profile in profiles:
try:
upload = [u for u in uploads if u.student.pk == profile.pk][0]
one = [s for s in school_one if s.student.pk == profile.pk][0]
two = [s for s in school_two if s.student.pk == profile.pk][0]
three = [s for s in school_three if s.student.pk == profile.pk][0]
four = [s for s in school_four if s.student.pk == profile.pk][0]
five = [s for s in school_five if s.student.pk == profile.pk][0]
except (AttributeError, IndexError):
pass
profile_dicts.append({
'upload': upload,
'school_one': one,
'school_two': two,
'school_three': three,
'school_four': four,
'school_five': five
})
for profile in profile_dicts:
upload = profile['upload']
if (
upload.english >= 50 and
upload.mathematics >= 50 and
upload.integrated_Science >= 50 and
upload.social_Studies >= 50
):
raw_score = (
upload.english +
upload.mathematics +
upload.integrated_Science +
upload.social_Studies +
upload.basic_Design_Technology +
upload.home_Economics
)
if raw_score >= 480:
place_me = profile['school_one']
elif raw_score >= 420:
place_me = profile['school_two']
elif raw_score >= 360:
place_me = profile['school_three']
elif raw_score >= 300:
place_me = profile['school_four']
else:
place_me = profile['school_five']
return render(request, 'schools/placement.html', {'place_me': place_me})
return HttpResponse("You did not qualify for placement.")
-