简体   繁体   English

更改themeforest主题的js功能

[英]Changing js functionality of themeforest theme

I purchased a theme off of http://themeforest.net and now the them was taken off. 我从http://themeforest.net购买了一个主题,然后将其删除。

The original theme functionality was to have all of the links pages inside of their own divs in the index page however I changed the functionality so that each link is on its own controller since I am using Codeigniter. 最初的主题功能是将所有链接页面都包含在索引页面中自己的div中,但是由于我使用Codeigniter,因此我更改了功能,以使每个链接都位于其自己的控制器上。

What I want to happen is when a new link is clicked it still rolls up the content div and goes to the clicked link and then rolls down the content of that page. 我想发生的是,当单击一个新链接时,它仍会向上滚动内容div并转到所单击的链接,然后向下滚动该页面的内容。 As of right now it rolls up ALL the way up the page and doesn't even load the new page. 截至目前,它一直沿页面向上滚动,甚至不加载新页面。 The commented section of code is what the original code was from the template. 代码的注释部分是模板中的原始代码。

/*****************************************************
MENU TRANSITION EFFECTS
******************************************************/
$("#menu1 ul li a").click(function(e){

e.preventDefault();
$('#container').animate({top:'-500px'},500,'easeInQuart');

/*
var id = $(this).attr("href");  
if(id == aid) return false; 
$('#menu1 ul li a').removeClass('a');
            $(this).addClass('a');
if($("#container > div:visible").size() > 0) {      
    $("#container > div:visible").animate({top:'-500px'},500,'easeInQuart',function(){ $("#container > div:visible").css({display:'none',top:'-500px'}); $('#container > div#' + id).css({display:'block'}).delay(400).animate({top:'500px'},800,'easeOutQuart');               
                $(function() {              
            $('.scroll').jScrollPane();
        });

     });
} else  {
    $('#container > div#' + id).css({display:'block'}).animate({top:'500px'},200,'easeOutQuart');
}
aid = id;
return false;
*/
});  

Edit: I tried it on my regular site and for some reason it wasn't working the same. 编辑:我在我的常规站点上尝试过它,由于某种原因,它不能正常工作。 Here's the template. 这是模板。 I uploaded it to one of my other sites for display. 我将其上传到其他网站之一进行显示。 Keep in mind the difference is that each link is a new controller and each div is a new view. 请记住,不同之处在于每个链接是一个新的控制器,每个div是一个新的视图。 Does that explain any further the differences between the original template and what I"m trying to accomplish. 这是否进一步解释了原始模板与我要完成的工作之间的区别。

http://www.justmyfiles.me/ http://www.justmyfiles.me/

Does anybody have any ideas? 有人有什么想法吗?

The "transition" javascript code could look like : “过渡” JavaScript代码可能类似于:

$("#menu1 ul li a").click(function(e){

    var a = this;
    e.preventDefault();

    $('#container').animate({top:'-500px'},500,'easeInQuart',function() {
        location.href = a.href;
    });
});

And the document ready code : 并准备好文件代码:

$(document).ready(function() {
    $('#container').animate({top:'0px'},500,'easeInQuart');
});

/*CSS*/ 
#container { top: -500px; }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM