I am using this slide and fade content for my website, basically you click on a menu button and it loads a div from an external page into the div thats on the same page as the menu (kinda like a one page website). This works perfectly, but the content of the divs that are loaded are sometimes kinda long, so I wanted to put a custom scrollbar on it. For some reason I cant seem to get the scrollbar on it tho, even when using reinitialise its still not working
Dont know if anyone could tell me whats wrong with this...
The one page website code:
The code for the slide fade content:Code:<head> <meta charset="utf-8"> <title>Untitled Document</title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> <script type="text/javascript" src="js/slide-fade-content.js"></script> <!--Jscrollpane--> <script type="text/javascript" src="js/jquery.jscrollpane.min.js"></script> <!--Jscrollmousewheel--> <script type="text/javascript" src="js/jquery.mousewheel.js"></script> <!--Jscrollstyle--> <link href="css/jquery.jscrollpane.css" rel="stylesheet" type="text/css" /> <style> body, html { height: 100%; width: 100%; margin: 0px; } p { color: #fff; } #container { width:100%; height: 100%; background: url(images/background.png) repeat-y fixed #000; } #wrapper { width: 960px; height: 100%; margin: 0px auto; } #left { width:320px; height:100%; background: #121212; margin-left: 10px; float: left; border: 10px double black; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; } #menu { width: 300px; } a { color: #fff; text-decoration: none; font-size:18px; font-style: oblique; } a:hover { background: #00d6f6; } #footer { width: 320px; position: absolute; bottom: 15px; text-align: center; color: #fff; } #content { width: 600px; height: 100%; margin-left: 30px; float: left; background: url(images/background-left1.png) bottom left no-repeat, url(images/background-left2.png) bottom right no-repeat, url(images/background-left4.png) top left no-repeat, url(images/background-left3.png) top right no-repeat, url(images/logobottom.png) bottom center no-repeat; } #ajax { margin-top: 113px; width: 500px; margin-left: auto; margin-right: auto; } .scroll-pane { overflow: visible; } </style> <script> $(function(){ $('#menu a').click(function () { $('#menu a').css('background', 'none'); $(this).css('background', '#00d6f6'); }); }); </script> </head> <body> <div id="container"> <div id="wrapper"> <div id="left"> <center><img src="images/logo.png"></center> <div id="menu"> <center><a class="more" href="#first-item"><b>Portfolio</b></a> <a class="more" href="#second-item"><b>About Me</b></a> <a class="more" href="#third-item"><b>Services</b></a><br></center> <center><a class="more" href="#fourth-item"><b>Contact</b></a></center> </div> <div id="footer">© DNDesign 2014</div> </div> <div id="content"> <div id="ajax" class="scroll-pane"></div> </div> </div> </div> </body> </html> <script type="text/javascript"> $(window).load(function() { $('.scroll-pane').jScrollPane(); }); </script>
The page with the divs that get loaded into the ajax div:Code:/* jQuery Color Fade v0.1 * Released under the CC BY 3.0 License (http://creativecommons.org/licenses/by/3.0/) * https://github.com/matthewbj/jQuery-Color-Fade */ (function(b){var c={init:function(a){var c=b.extend({fadeColor:"#00d6f6",fadeTime:800,delayTime:600},a),d={position:"relative","z-index":1},e={height:"100%",width:"100%","background-color":c.fadeColor,position:"absolute",top:0,left:0,"z-index":"-1"};return this.each(function(a){b(this).css(d).append('<div id="colorFadeDiv'+a+'" class="colorFadeClass"></div>');b("#colorFadeDiv"+a).css(e).delay(c.delayTime).fadeOut(c.fadeTime)})},refade:function(a){a=b.extend({fadeColor:"#00d6f6",fadeTime:800,delayTime:600}, a);b(this).find(".colorFadeClass").css("background-color",a.fadeColor).show().delay(a.delayTime).fadeOut(a.fadeTime)}};b.fn.colorFade=function(a){if(c[a])return c[a].apply(this,Array.prototype.slice.call(arguments,1));if("object"===typeof a||!a)return c.init.apply(this,arguments);b.error("Method "+a+" does not exist on jQuery.colorFade")}})(jQuery); // slide & fade content jQuery(document).ready(function($) { $('.more').on('click', function() { var href = $(this).attr('href'); if ($('#ajax').is(':visible')) { $('#ajax').css({ display:'block' }).animate({ height:'0' }).empty(); } $('#ajax').css({ display:'block' }).animate({ height:'450px' },function() { $('#ajax').html('<img id="loader" src="loader.gif">'); $('#loader').css({ border:'none', position:'relative', top:'24px', left:'48px', boxShadow:'none' }); // http://loadinfo.net/ $('#ajax').load('slide-fade-content.html ' + href, function() { $('#ajax').hide().fadeIn('slow').colorFade({ 'fadeColor': '#00d6f6' }); }); }); }); });
I hope this is not impossible to do? =xCode:<div id="load"> <div id="first-item"> <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Phasellus hendrerit. Pellentesque aliquet nibh nec urna. In nisi neque, aliquet vel, dapibus id, mattis vel, nisi. Sed pretium, ligula sollicitudin laoreet viverra, tortor libero sodales leo, eget blandit nunc tortor eu nibh. Nullam mollis. Ut justo. Suspendisse potenti.</p> </div> <div id="second-item"> <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Phasellus hendrerit. Pellentesque aliquet nibh nec urna. In nisi neque, aliquet vel, dapibus id, mattis vel, nisi. Sed pretium, ligula sollicitudin laoreet viverra, tortor libero sodales leo, eget blandit nunc tortor eu nibh. Nullam mollis. Ut justo. Suspendisse potenti.</p> </div> <div id="third-item"> <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Phasellus hendrerit. Pellentesque aliquet nibh nec urna. In nisi neque, aliquet vel, dapibus id, mattis vel, nisi. Sed pretium, ligula sollicitudin laoreet viverra, tortor libero sodales leo, eget blandit nunc tortor eu nibh. Nullam mollis. Ut justo. Suspendisse potenti.</p> </div> <div id="fourth-item"> <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Phasellus hendrerit. Pellentesque aliquet nibh nec urna. In nisi neque, aliquet vel, dapibus id, mattis vel, nisi. Sed pretium, ligula sollicitudin laoreet viverra, tortor libero sodales leo, eget blandit nunc tortor eu nibh. Nullam mollis. Ut justo. Suspendisse potenti.</p> </div> </div>
also: the link to the JScrollPane webpage jscrollpane.kelvinluck.com




Reply With Quote


Bookmarks