Template:Demos sifuentes

From 2014.igem.org

(Difference between revisions)
Line 1: Line 1:
<html>
<html>
 +
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"></script>
 +
<script type="text/javascript">
 +
$(document).ready(function() {
 +
//Show the paging and activate its first link
 +
$(".paging").show();
 +
$(".paging a:first").addClass("active");
-
<!-- STYLESHEET -->
+
//Get size of the image, how many images there are, then determin the size of the image reel.
-
<!-- *********** -->
+
var imageWidth = $(".window").width();
 +
var imageSum = $(".image_reel img").size();
 +
var imageReelWidth = imageWidth * imageSum;
 +
//Adjust the image reel to its new size
 +
$(".image_reel").css({'width' : imageReelWidth});
 +
//Paging  and Slider Function
 +
rotate = function(){
 +
var triggerID = $active.attr("rel") - 1; //Get number of times to slide
 +
var image_reelPosition = triggerID * imageWidth; //Determines the distance the image reel needs to slide
 +
$(".paging a").removeClass('active'); //Remove all active class
 +
$active.addClass('active'); //Add active class (the $active is declared in the rotateSwitch function)
-
<!-- JAVASCRIPTS -->
+
//Slider Animation
-
<!-- *********** -->
+
$(".image_reel").animate({
 +
left: -image_reelPosition
 +
}, 500 );
 +
};
-
    <!-- ie9.js (fixes all Internet Explorer browsers older than ie9) -->
+
//Rotation  and Timing Event
-
    <!--[if lt IE 9]>
+
rotateSwitch = function(){
-
    <script src="http://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE9.js"></script>
+
play = setInterval(function(){ //Set timer - this will repeat itself every 7 seconds
-
    <![endif]-->
+
$active = $('.paging a.active').next(); //Move to the next paging
 +
if ( $active.length === 0) { //If paging reaches the end...
 +
$active = $('.paging a:first'); //go back to first
 +
}
 +
rotate(); //Trigger the paging and slider function
 +
}, 6000); //Timer speed in milliseconds (6 seconds)
 +
};
-
    <!-- jQuery Tools (slider) -->
+
rotateSwitch(); //Run function on launch
-
    <script src="http://cdn.jquerytools.org/1.2.5/full/jquery.tools.min.js"></script>
+
-
    <script>
+
-
        $(function() {
+
-
        // initialize scrollable
+
-
        $(".scrollable").scrollable().navigator();
+
-
        });
+
-
    </script>
+
-
    <!-- Navigation scroll follow -->
+
//On Hover
-
    <script type="text/javascript">
+
//$(".image_reel a").hover(function() {
-
        var prevScrollPos = -1000;
+
//clearInterval(play); //Stop the rotation
-
        $(window).scroll(function () {
+
//}, function() {
-
           
+
//rotateSwitch(); //Resume rotation timer
-
            <!-- here is added table of content fixing to screen : was all 35 with Title OutsideWhitebox-->
+
//});
-
            var scrollPos = Math.floor($(window).scrollTop());
+
-
            if(Math.abs(prevScrollPos - scrollPos) <= 1){
+
//On Click
-
                  return "nuthin";
+
$(".pause a").click(function() {
-
            }
+
clearInterval(play); //Stop the rotation
-
 
+
});
-
            var toc_margin_from_top = $(".navigation").height() + 35;
 
-
            var scroll_pos_above_start_of_article = scrollPos < $(".whitebox.article").offset().top - 68;
 
-
            var toc_end_reached_bottom_of_article = scrollPos + toc_margin_from_top + $(".toc").height() > $(".whitebox.article").offset().top + $(".whitebox.article").height() - 35;
 
-
            var toc_margin_from_title = scrollPos < ($(".whitebox.article").offset().top );
 
-
           
 
 +
//On Click
 +
$(".paging a").click(function() {
 +
$active = $(this); //Activate the clicked paging
 +
//Reset Timer
 +
clearInterval(play); //Stop the rotation
 +
rotate(); //Trigger rotation immediately
 +
rotateSwitch(); // Resume rotation timer
 +
return false; //Prevent browser jump to link anchor
 +
});
 +
});
 +
</script>
-
            if(scroll_pos_above_start_of_article){
+
<script type="text/javascript">
-
                  $(".toc").offset({top: $(".whitebox.article").offset().top + 68});
+
$(document).ready(function() {
-
            } else if(toc_end_reached_bottom_of_article){
+
-
                  $(".toc").offset({top: $(".whitebox.article").offset().top + $(".whitebox.article").height() - $(".toc").height() - 35});
+
-
            } else if(toc_margin_from_title){
+
-
                  $(".toc").offset({top: $(".whitebox.article").offset().top + 68});
+
-
            } else {
+
-
                  $(".toc").offset({top: scrollPos + toc_margin_from_top});
+
-
            }
+
-
<!-- new attempt to fix menubar (jakob) -->
+
-
            var scroll_pos_above_menubar = scrollPos < 250;
+
$(".main_image .desc").show(); //Show Banner
 +
$(".main_image .block").animate({ opacity: 0.85 }, 1 ); //Set Opacity
 +
$(".image_thumb ul li:first").addClass('active'); //Add the active class (highlights the very first list item by default)
 +
$(".image_thumb ul li").click(function(){
 +
    //Set Variables
 +
    var imgAlt = $(this).find('img').attr("alt"); //Get Alt Tag of Image
 +
    var imgTitle = $(this).find('a').attr("href"); //Get Main Image URL
 +
    var imgDesc = $(this).find('.block').html();  //Get HTML of the "block" container
 +
    var imgDescHeight = $(".main_image").find('.block').height(); //Find the height of the "block"
-
            if(scroll_pos_above_menubar){
+
    if ($(this).is(".active")) {  //If the list item is active/selected, then...
-
                  $(".navigation").offset({top: 250 });
+
        return false; // Don't click through - Prevents repetitive animations on active/selected list-item
-
            } else {
+
    } else { //If not active then...
-
                  $(".navigation").offset({top: scrollPos});
+
        //Animate the Description
-
            }
+
        $(".main_image .block").animate({ opacity: 0, marginBottom: -imgDescHeight }, 250 , function() { //Pull the block down (negative bottom margin of its own height)
-
 
+
            $(".main_image .block").html(imgDesc).animate({ opacity: 0.85,  marginBottom: "0" }, 250 ); //swap the html of the block, then pull the block container back up and set opacity
-
            //if (scroll_pos_below_start_of_article){ //&& (scrollPos < $(document).height() - $(".navigation")[0].height() - 70)) {
+
             $(".main_image img").attr({ src: imgTitle , alt: imgAlt}); //Switch the main image (URL + alt tag)
-
            //    $(".toc").addClass("stickBelowNavigation");
+
-
            //} else {
+
-
             //  $(".toc").removeClass("stickBelowNavigation");
+
-
            //}
+
         });
         });
-
     </script>
+
     }
-
 
+
     //Show active list-item
-
    <!-- MathJax (LaTeX for the web) -->
+
     $(".image_thumb ul li").removeClass('active'); //Remove class of 'active' on all list-items
-
    <script type="text/x-mathjax-config">
+
    $(this).addClass('active'); //Add class of 'active' on the selected list
-
        MathJax.Hub.Config({tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]}});
+
     return false;
-
        MathJax.Hub.Config({
+
-
            TeX: {
+
-
                equationNumbers: {  autoNumber: "AMS"  }
+
-
            }
+
-
        });
+
-
     </script>
+
-
    <script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
+
-
 
+
-
     <!-- Drop Down navigation -->
+
-
    <script type="text/javascript">
+
-
        $(document).ready(
+
-
            function(){
+
-
                $("ul.subnav").parent().find("> a").append("<span> ▼</span>");
+
-
                $("ul.topnav li").hover(
+
-
                    function() {
+
-
                        // Hover over
+
-
                        $(this).parent().find("ul.subnav").hide();
+
-
                        $(this).find("ul.subnav").show();
+
-
                        // Hover out
+
-
                        $(this).hover(
+
-
                            function() {
+
-
                            },
+
-
                            function(){
+
-
                                $(this).find("ul.subnav").hide();
+
-
                            }
+
-
                        );
+
-
                    },
+
-
                    function(){
+
-
                        $(this).find("ul.subnav").hide();
+
-
                    }
+
-
 
+
-
                );
+
-
            }
+
-
        );
+
-
    </script>
+
-
 
+
-
    <!-- iGem wiki hacks -->
+
-
        <!-- Remove all empty <p> tags -->
+
-
        <script type="text/javascript">
+
-
            $(document).ready(function() {
+
-
                $("p").filter( function() {
+
-
                    return $.trim($(this).html()) == '';
+
-
                }).remove();
+
-
            });
+
-
        </script>
+
-
 
+
-
        <!-- Remove "team" from the menubar -->
+
-
        <script type="text/javascript">
+
-
            $(document).ready(function() {
+
-
                $("menubar > ul > li:last-child").remove();
+
-
            });
+
-
        </script>
+
-
 
+
-
        <!-- If Empty heading -> Then remove it -->
+
-
        <script type="text/javascript">
+
-
            $(document).ready(function() {
+
-
                if ("" == "</html>{{{1}}}<html>") {
+
-
                    $("#heading").remove();
+
-
                }
+
-
            });
+
-
        </script>
+
-
 
+
-
<!-- HTML CONTENT -->
+
-
<!-- ************ -->
+
-
 
+
-
    <!-- Header image -->
+
-
 
+
-
    <div id="header">
+
-
        <div class="centering">
+
-
        </div>
+
-
     </div>
+
-
 
+
-
    <!-- Navigation bar -->
+
-
    </html>{{:Team:DTU-Denmark/Templates/Navigationbar2}}<html>
+
-
 
+
-
 
+
-
    <!-- Prepare for content -->
+
-
    <div id="innercontent">
+
-
        <div class="centering">
+
-
            <div class="whitebox article">
+
-
 
+
-
<div class="overviewPage">           
+
-
<h1>
+
-
</html>
+
-
{{{1}}}
+
-
<html>
+
-
</h1>
+
-
</div>
+
 +
}) .hover(function(){ //Hover effects on list-item
 +
    $(this).addClass('hover'); //Add class "hover" on hover
 +
    }, function() {
 +
    $(this).removeClass('hover'); //Remove class "hover" on hover out
 +
});
 +
$("a.collapse").click(function(){
 +
    $(".main_banner .block").slideToggle(); //Toggle the description (slide up and down)
 +
    $("a.collapse").toggleClass("show"); //Toggle the class name of "show" (the hide/show tab)
 +
});
 +
});//Close Function
 +
</script>
</html>
</html>

Revision as of 20:55, 1 December 2014