2015-10-07 57 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正在创建这个问题。我需要从该文件中删除什么? –

相关问题