Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › Web Coding › Need help with jQuery
New Posts  All Forums:Forum Nav:

Need help with jQuery

post #1 of 2
Thread Starter 
I currently have two approaches to what I'm trying to accomplish:

1. Dynamically change the contents of a javascript when a hyperlink is clicked.
2. When a hyperlink is clicked, stop the old script and simply load a new one.

This is the jQuery function I'm using:
Code:
jQuery(function($){
        jQuery.supersized({
                slide_interval           :   7000,      // Length between transitions
           transition                 :   1,          // 0-None, 1-Fade, 2-Slide Top, 3-Slide Right, 4-Slide Bottom, 5-Slide Left, 6-Carousel Right, 7-Carousel Left
           transition_speed      :   1000,      // Speed of transition

                slides:
                        [
                                {image:'http://i.imgur.com/xewGG.jpg'},
                                {image:'http://i.imgur.com/zscou.jpg'},
                                {image:'http://i.imgur.com/kKCDT.jpg'},
                                {image:'http://i.imgur.com/UsrIF.jpg'},
                                {image:'http://i.imgur.com/IQNMw.jpg'},
                                {image:'http://i.imgur.com/8GtT2.jpg'},
                                {image:'http://i.imgur.com/oIxRV.jpg'},
                                {image:'http://i.imgur.com/AB9b5.jpg'},
                                {image:'http://i.imgur.com/AR6Jr.jpg'}
                        ]
        });
});

With my first approach, I want to dynamically change the URLs for each image when a hyperlink is clicked.

With my second approach, I will have two copies of the above script, but with different images, so that I can call the correct script when the hyperlink is clicked.

Any suggestions?
post #2 of 2
answer http://forum.jquery.com/topic/supersize-change-slides-at-runtime

add a second script and a link or button to bind to
Code:
<script>
$(document).ready(function(){
  $("#newslides").click(function(){
  $("#supersized").remove();
  $('body').append('<div id="supersized-loader"></div><ul id="supersized"></ul>');
         jQuery.supersized({
                slide_interval           :   1000,      // Length between transitions
           transition                 :   1,          // 0-None, 1-Fade, 2-Slide Top, 3-Slide Right, 4-Slide Bottom, 5-Slide Left, 6-Carousel Right, 7-Carousel Left
           transition_speed      :   1000,      // Speed of transition

                slides:
                        [
                                {image:'http://lorempixel.com/400/200/transport/1'},
                                {image:'http://lorempixel.com/400/200/transport/2'},
                                {image:'http://lorempixel.com/400/200/transport/3'},
                                {image:'http://lorempixel.com/400/200/transport/4'},
                                {image:'http://lorempixel.com/400/200/transport/5'},
                                {image:'http://lorempixel.com/400/200/transport/6'},
                                {image:'http://lorempixel.com/400/200/transport/7'},
                                {image:'http://lorempixel.com/400/200/transport/8'},
                                {image:'http://lorempixel.com/400/200/transport/9'}
                        ]
        });
  });
});
</script>
Core I7
(13 items)
 
  
CPUMotherboardGraphicsRAM
I7 920 rev. D0 @ 4.26Ghz EVGA X58 SLI EVGA GTX 285 OCZ XMP 3x2Gb (pc3 12800) 
Hard DriveOptical DriveOSMonitor
Western Digital Caviar Black 640Gb x 2 LG GH22LS30 openSuse 12.1 x64 HP F2105 
PowerCase
CORSAIR 850TX Cooler Master ATCS 840 
  hide details  
Reply
Core I7
(13 items)
 
  
CPUMotherboardGraphicsRAM
I7 920 rev. D0 @ 4.26Ghz EVGA X58 SLI EVGA GTX 285 OCZ XMP 3x2Gb (pc3 12800) 
Hard DriveOptical DriveOSMonitor
Western Digital Caviar Black 640Gb x 2 LG GH22LS30 openSuse 12.1 x64 HP F2105 
PowerCase
CORSAIR 850TX Cooler Master ATCS 840 
  hide details  
Reply
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Web Coding
Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › Web Coding › Need help with jQuery