Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
- "http://www.w3.org/TR/html4/strict.dtd"
- >
- <html lang="en">
- <head>
- <title><!-- Insert your title here --></title>
- <script src="http://code.jquery.com/jquery-1.4.4.min.js"></script>
- <script src="http://www.inforum.com/javascript/jqueryui/js/jquery.tools.min.scrollableOnly.js" type="text/javascript"></script>
- <style type="text/css">
- .left {
- float: left;
- }
- .article_brief_box {
- margin: 10px 6px 0 13px;
- padding: 0 0 10px 0;
- border-bottom: 1px solid #ccc;
- width: 305px;
- }
- div {
- display: block;
- }
- .clearfix::after {
- content: ".";
- display: block;
- height: 0;
- clear: both;
- visibility: hidden;
- }
- .tagAccordionBtn
- {
- border: 1px solid #ccc;
- cursor: pointer;
- background-image:url('http://www.inforum.com/dynamic/original/png/2010/12/21/bg_tr_group_headers_hover.png');
- background-position:center;
- background-repeat:repeat-x;
- font-weight:bold;
- padding:5px;
- margin: 0;
- -moz-border-radius: 4px; /* {cornerRadius} */
- -webkit-border-radius: 4px; /* {cornerRadius} */
- color:#FFF;
- float: left;
- width:300px;
- _float: none; /* Float works in all browsers but IE6 */
- display: block;
- }
- .accordionContent {
- float: left;
- width:310px;
- padding: 5px 0;
- display: none;
- }
- .on {
- background: #13416e;
- }
- .over {
- background: #000;
- }
- .scrollableTagFeed
- {
- /* required */
- position:relative;
- overflow: hidden;
- width: 265px;
- height:90px;
- /* misc */
- float:left;
- margin:0 3px;
- }
- .scrollableTagFeed .items {
- /* Both Required */
- width:20000em;
- position:absolute;
- }
- .scrollableTagFeed .items div {
- float:left;
- width:260px;
- margin:5px;
- }
- /* prev next buttons */
- .prev {
- background-image:url('http://www.inforum.com/dynamic/original/png/2010/12/21/prev_button.png');
- width:18px;
- height: 30px;
- cursor: pointer;
- display:block;
- float:left;
- margin-top:20px;
- }
- .next {
- background-image:url('http://www.inforum.com/dynamic/original/png/2010/12/21/next_button.png');
- width:18px;
- height: 30px;
- cursor: pointer;
- display:block;
- float:left;
- margin-top:20px;
- }
- </style>
- <script>
- // truncates string to max words
- function truncate(stringToChange, maxChars) {
- if (maxChars < stringToChange.length) {
- stringToChange = stringToChange.substr(0, maxChars);
- return stringToChange.replace(/\W+\w+[.!?]?\s*$/, '...');
- } else {
- return stringToChange;
- }
- }
- $(function() {
- $('.tagAccordionBtn')
- .mouseover(function() {
- $(this).addClass('over');
- })
- .mouseout(function() {
- $(this).removeClass('over');
- });
- // Create a list of feed urls to pull data from.
- var feedList = [
- 'event/json.tag/tag/food',
- 'event/json.tag/tag/health',
- 'event/json.tag/tag/Travel',
- 'event/json.tag/tag/money',
- 'event/json.tag/tag/dragons'
- ];
- for (feed in feedList) {
- var index = 0;
- // For each feed we fetch the remote JSON using jQuery's
- // .getJSON() method.
- $.getJSON(feedList[feed], function(data) {
- // The feeds return an array of objects representing articles
- $.each(data.items, function(i, article) {
- // for each article we pull out what we need and attach it to
- // the appropriate div
- var htmlFeed = '<div><strong><a href="' +
- article.url +
- '" style="font-size:14px;">' +
- article.title +
- '</a></strong><br />' +
- truncate(article.brief, 80) +
- '</div>';
- $('#feedNum' + index).append(htmlFeed);
- });
- index++;
- });
- // The above ajax call fills divs with the ids feed0 through feed4
- // with a child div for each JSON object we received. After each call
- // completes then the divs are ready to be used.
- $('#feed' + feed).ajaxStop(function() {
- // Use the jquery tools scrollable method to make the underlying
- // divs scroll horizontally every 6 seconds. We set the circular
- // property to true so that the list cycles back to the beginning
- // after we reach the end.
- $(this).scrollable({circular: true}).autoscroll({interval: 6000});
- // Once the divs inside each section are scrollable, then we
- // allow the accordion to display them by attaching a click handler to the button above.
- // Since the button is the previous sibling of the parent div we use .parent().prev()
- // to get the button object.
- $(this).parent().prev()
- .click(function() {
- $('.tagAccordionBtn').removeClass('on');
- // Close all open sections.
- $('.accordionContent').slideUp('normal');
- // Open the next section if it's not already open.
- if($(this).next().is(':hidden') == true)
- {
- $(this).addClass('on');
- $(this).next().slideDown('normal');
- }
- });
- });
- }
- });
- </script>
- </head>
- <body>
- <div class="left">
- <div class="article_brief_box clearfix">
- <div class="tagAccordionBtn largetxt" rel="0">
- <noscript>
- <a href="http://www.inforum.com/event/tag/tag/food">
- </noscript>
- Food
- <noscript>
- </a>
- </noscript>
- </div>
- <div class="accordionContent">
- <a class="prev"> </a>
- <div class="scrollableTagFeed" id="feed0"><div class="items" id="feedNum0"> </div></div>
- <a class="next"> </a>
- </div>
- <div class="tagAccordionBtn largetxt" rel="1">
- <noscript>
- <a href="http://www.inforum.com/event/tag/tag/health">
- </noscript>
- Health
- <noscript>
- </a>
- </noscript>
- </div>
- <div class="accordionContent">
- <a class="prev"> </a>
- <div class="scrollableTagFeed" id="feed1"><div class="items" id="feedNum1"> </div></div>
- <a class="next"> </a>
- </div>
- <div class="tagAccordionBtn largetxt" rel="2">
- <noscript>
- <a href="http://www.inforum.com/event/tag/tag/Travel">
- </noscript>
- Travel
- <noscript>
- </a>
- </noscript>
- </div>
- <div class="accordionContent">
- <a class="prev"> </a>
- <div class="scrollableTagFeed" id="feed2"><div class="items" id="feedNum2"> </div></div>
- <a class="next"> </a>
- </div>
- <div class="tagAccordionBtn largetxt" rel="3">
- <noscript>
- <a href="http://www.inforum.com/event/tag/tag/money">
- </noscript>
- Money
- <noscript>
- </a>
- </noscript>
- </div>
- <div class="accordionContent">
- <a class="prev"> </a>
- <div class="scrollableTagFeed" id="feed3"><div class="items" id="feedNum3"> </div></div>
- <a class="next"> </a>
- </div>
- <div class="tagAccordionBtn largetxt" rel="4">
- <noscript>
- <a href="http://www.inforum.com/event/tag/tag/family">
- </noscript>
- Family
- <noscript>
- </a>
- </noscript>
- </div>
- <div class="accordionContent">
- <a class="prev"> </a>
- <div class="scrollableTagFeed" id="feed4"><div class="items" id="feedNum4"> </div></div>
- <a class="next"> </a>
- </div>
- </div>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement