저는 새로운 자바 스크립트입니다. 나는 다른 뷰에서로드하는 .load 스크립트를 만들 수 있었다 (많은 도움을 줌). 작동하지만 사용자가 www.mydomain.com/#view3과 같은 URL을 사용할 때 스크립트가 적절한보기로로드되도록하는 방법을 모르겠다.html5 history api fallback?
이 기존의 문제 외에도 현재의 현재 위치를 바꾸고 싶습니다. html5 히스토리 API를 사용하여 스크립트를로드하고 클라이언트 브라우저가이를 지원하지 않을 때 이전 스크립트로 폴백하십시오. 브라우저가 히스토리 API를 지원하는지, 대체 방식을 만드는 방법이 아닌지 어떻게 알 수 있습니까? 나는 modernizr이 fallbacks를위한 CSS 클래스를 지원한다는 것을 알고 있습니다. 같은 lib에 javascript에 lib가 존재합니까?
나는 그 많은 것을 알고있다. 메신저는 현재의 자신을 읽기하지만 메신저는 좀 가압 : -/
이 내 corrent 코드 : 불행하게도 나는 다른보기를로드의 문제에 대단히 도움이되지 수 음
$(document).ready(function() {
$(".con").load("views/startseite.php", function() {
$(".scroll").jScrollPane({mouseWheelSpeed:20});$(".jspDrag").hide();$(".jspScrollable").mouseenter(function(){$(this).find(".jspDrag").stop(!0,!0).fadeIn()});$(".jspScrollable").mouseleave(function(){$(this).find(".jspDrag").stop(!0,!0).fadeOut()})
});
$("nav a").click(function (a) {
a.preventDefault();
a = $(this).attr("href").split("/").pop().split(".").shift();
$(".con").hide().load("views/" + a + ".php", function() {
$(".con").fadeIn("fast",
function() {
$(".scroll").jScrollPane({mouseWheelSpeed:20});$(".jspDrag").hide();$(".jspScrollable").mouseenter(function(){$(this).find(".jspDrag").stop(!0,!0).fadeIn("slow")});$(".jspScrollable").mouseleave(function(){$(this).find(".jspDrag").stop(!0,!0).fadeOut("slow")})})
});
document.title = "My-Domain.com | " + (a.substr(0, 1).toUpperCase() + a.substr(1));
location.hash = a;
return !1
})
$(document).on('submit', 'form.ajax', function (e) {
e.preventDefault();
var that = $(this),
url = that.attr('action'),
type = that.attr('method'),
data = {};
that.find('[name]').each(function (index, value) {
var that = $(this),
name = that.attr('name'),
value = that.val();
data[name] = value
});
$.ajax({
url: url,
type: type,
data: data,
success: function() {
$(".flipbox").flippy({
color_target: "",
duration: "500",
verso: "Anything!",
onFinish: function() {
$("#no-color").css("background-color", "transparent");
}
});
}
});
});
$(document).on('submit', 'form.lebenslauf', function (e) {
e.preventDefault();
var $this = $(this);
$.ajax({
url: './secure/secure.php',
type: 'post',
data: {
code: $('input[name=bewerbung]').val()
},
success: function (resp) {
if (resp.substr(0, 5) == "Error") {
$('.error').html(resp);
} else {
$('.flipbox').flippy({
duration: "500",
verso: resp,
onFinish: function() {
$(".flipbox").css("background-color", "transparent");
}
});
}
}
});
});
});