2015-10-07 56 views
0

訪問子文件夾中的HTML文件我有我的HTML應用程序index.html文件的主文件夾。我已經在訪問該文件(index.html的)存在於該子文件夾如下主文件夾的的index.html編寫的代碼,無法通過<a>標籤

<a href="subfolder/index.html">SubFile</a> 

當我點擊上面的鏈接上,它不導航到子文件和主文件夾的index.html文件的變化,而不是鏈接mainfolder/index.html的#!/子/ index.html的

我甚至試圖改變的子文件夾的文件,但沒有成功的名稱。可能是什麼問題呢?

我也想從子文件夾如下導航回到主文件夾的index.html,

<a href="../index.html">Mainfile</a> 

但它也不能正常工作。我怎樣才能做到這一點?

編輯:

文件my-app.js正在創建該問題。 my-app.js的代碼如下,

// Initialize your app 
var myApp = new Framework7({ 
    animateNavBackIcon: true, 
    // Enable templates auto precompilation 
    precompileTemplates: true, 
    // Enabled pages rendering using Template7 
    swipeBackPage: false, 
    swipeBackPageThreshold: 1, 
    swipePanel: "left", 
    swipePanelCloseOpposite: true, 
    pushState: true, 
    pushStateRoot: undefined, 
    pushStateNoAnimation: false, 
    pushStateSeparator: '#!/', 
    template7Pages: true 
}); 


// Export selectors engine 
var $$ = Dom7; 

// Add main View 
var mainView = myApp.addView('.view-main', { 
    // Enable dynamic Navbar 
    dynamicNavbar: false 
}); 


$$(document).on('pageInit', function (e) { 
     $(".swipebox").swipebox(); 


    $("#ContactForm").validate({ 
    submitHandler: function(form) { 
    ajaxContact(form); 
    return false; 
    } 
    }); 

    $('a.backbutton').click(function(){ 
     parent.history.back(); 
     return false; 
    }); 


    $(".posts li").hide(); 
    size_li = $(".posts li").size(); 
    x=4; 
    $('.posts li:lt('+x+')').show(); 
    $('#loadMore').click(function() { 
     x= (x+1 <= size_li) ? x+1 : size_li; 
     $('.posts li:lt('+x+')').show(); 
     if(x == size_li){ 
      $('#loadMore').hide(); 
      $('#showLess').show(); 
     } 
    }); 


$("a.switcher").bind("click", function(e){ 
    e.preventDefault(); 

    var theid = $(this).attr("id"); 
    var theproducts = $("ul#photoslist"); 
    var classNames = $(this).attr('class').split(' '); 


    if($(this).hasClass("active")) { 
     // if currently clicked button has the active class 
     // then we do nothing! 
     return false; 
    } else { 
     // otherwise we are clicking on the inactive button 
     // and in the process of switching views! 

     if(theid == "view13") { 
      $(this).addClass("active"); 
      $("#view11").removeClass("active"); 
      $("#view11").children("img").attr("src","images/switch_11.png"); 

      $("#view12").removeClass("active"); 
      $("#view12").children("img").attr("src","images/switch_12.png"); 

      var theimg = $(this).children("img"); 
      theimg.attr("src","images/switch_13_active.png"); 

      // remove the list class and change to grid 
      theproducts.removeClass("photo_gallery_11"); 
      theproducts.removeClass("photo_gallery_12"); 
      theproducts.addClass("photo_gallery_13"); 

     } 

     else if(theid == "view12") { 
      $(this).addClass("active"); 
      $("#view11").removeClass("active"); 
      $("#view11").children("img").attr("src","images/switch_11.png"); 

      $("#view13").removeClass("active"); 
      $("#view13").children("img").attr("src","images/switch_13.png"); 

      var theimg = $(this).children("img"); 
      theimg.attr("src","images/switch_12_active.png"); 

      // remove the list class and change to grid 
      theproducts.removeClass("photo_gallery_11"); 
      theproducts.removeClass("photo_gallery_13"); 
      theproducts.addClass("photo_gallery_12"); 

     } 
     else if(theid == "view11") { 
      $("#view12").removeClass("active"); 
      $("#view12").children("img").attr("src","images/switch_12.png"); 

      $("#view13").removeClass("active"); 
      $("#view13").children("img").attr("src","images/switch_13.png"); 

      var theimg = $(this).children("img"); 
      theimg.attr("src","images/switch_11_active.png"); 

      // remove the list class and change to grid 
      theproducts.removeClass("photo_gallery_12"); 
      theproducts.removeClass("photo_gallery_13"); 
      theproducts.addClass("photo_gallery_11"); 

     } 

    } 

}); 

document.addEventListener('touchmove', function(event) { 
    if(event.target.parentNode.className.indexOf('navbarpages') != -1 || event.target.className.indexOf('navbarpages') != -1) { 
    event.preventDefault(); } 
}, false); 

// Add ScrollFix 
var scrollingContent = document.getElementById("pages_maincontent"); 
new ScrollFix(scrollingContent); 


var ScrollFix = function(elem) { 
    // Variables to track inputs 
    var startY = startTopScroll = deltaY = undefined, 

    elem = elem || elem.querySelector(elem); 

    // If there is no element, then do nothing 
    if(!elem) 
     return; 

    // Handle the start of interactions 
    elem.addEventListener('touchstart', function(event){ 
     startY = event.touches[0].pageY; 
     startTopScroll = elem.scrollTop; 

     if(startTopScroll <= 0) 
      elem.scrollTop = 1; 

     if(startTopScroll + elem.offsetHeight >= elem.scrollHeight) 
      elem.scrollTop = elem.scrollHeight - elem.offsetHeight - 1; 
    }, false); 
}; 

}) 

我應該從中刪除什麼來解決我的問題?

+0

你的根目錄中是否有任何htaccess文件? – Mitul

+0

@Mitul,不!沒有htaccess文件。 –

+0

爲什麼子文件夾url是'mainfolder/index.html#!/子文件夾/ index.html' – Mitul

回答

0

#!/subfolder/index.html

這讓我覺得,您使用的是單頁的應用程序框架/庫,如角或東西有關。所以也許你的問題不在html中,而是在你的javascript代碼中。

+0

其實我已經下載了html應用程序。我不確定框架。那我該如何解決呢?我通過js文件夾。有像email.js,framework7.js,jquery.swipebox.js等文件 –

0

請移除所有的JavaScript,並檢查它會正常工作,然後恢復所有的JS逐一測試,你會發現JavaScript的解決衝突的矛盾。它會正常工作。

+0

我試過你的答案。我開始知道my-app.js正在創建這個問題。我需要從該文件中刪除什麼? –

相關問題