JS help

  • Started
  • Last post
  • 5 Responses
  • ESKEMA

    playToggle : function(state){

    if (state =='play'){
    // If image, swap to pause
    if ($(vars.play_button).attr('src... $(vars.play_button).attr("src", vars.image_path + "pause.png");
    if (api.options.progress_bar && !vars.is_paused) theme.progressBar();
    }else if (state == 'pause'){
    // If image, swap to play
    if ($(vars.play_button).attr('src... $(vars.play_button).attr("src", vars.image_path + "play.png");
    if (api.options.progress_bar && vars.is_paused)$(vars.progress_b... : -$(window).width()}, 0 );
    }

    },

    How would I go to change that code so that I can replace the play/pause images by text instead?

    Thanks

  • spot130

    I think you'll need to change some other code as well as this function. Do you have a link?

  • ESKEMA0

    I'm modifying the default supersized shutter theme.
    it also appears here:

    _init : function(){

    // Center Slide Links
    if (api.options.slide_links) $(vars.slide_list).css('margin-l... -$(vars.slide_list).width()/2);

    // Start progressbar if autoplay enabled
    if (api.options.autoplay){
    if (api.options.progress_bar) theme.progressBar();
    }else{
    if ($(vars.play_button).attr('src... $(vars.play_button).attr("src", vars.image_path + "play.png"); // If pause play button is image, swap src
    if (api.options.progress_bar) $(vars.progress_bar).stop().anim... : -$(window).width()}, 0 ); // Place progress bar
    }

    and then there's the <img> pause.png in the html that this code swaps.. I want it to swap text instead of images. can't figure out how.

  • spot130

    You can try something like this:
    if (state =='play'){
    // If image, swap to pause
    //if ($(vars.play_button).attr('src... $(vars.play_button).attr("src", vars.image_path + "pause.png");
    document.getElementById("txtBtn... = '<a id=\"play-button\">Play</a>';
    if (api.options.progress_bar && !vars.is_paused) theme.progressBar();
    }else if (state == 'pause'){
    // If image, swap to play
    //if ($(vars.play_button).attr('src... $(vars.play_button).attr("src", vars.image_path + "play.png");
    document.getElementById("txtBtn... = '<a id=\"play-button\">Pause</a>';
    if (api.options.progress_bar && vars.is_paused)$(vars.progress_b... : -$(window).width()}, 0 );
    }

    but you'll need to replace the image with a div with the id="txtBtn" and add the link inside it.

  • spot130

    I'm feeling rather generous today so I just did it for you:
    http://www.i13.ca/supersized-tex…

  • ESKEMA0

    wow thank you spot. made my day.

    cheers