Skip to main content

JS Style Switcher for BG Images 77 Responses

Last post: 2 years, 3 months ago | Thread started: Jan 28, 10, 9:15 p.m.

RespondNew TopicDisable Images

  • BusterBoy

    Not exactly what I was after mate.

    What I mean is when you click a link on a page, the background image switches to a new BG image without the whole page being reloaded.

    next note >+ add note

    You must be logged in to add a note. Login now or register for an account.

    Cancel
    Dog-earJan 28, 10, 9:38 p.m. – Permalink
  • acescence

    this should get you started..
    http://culturekiller.com/qbeans/…

    next note >add note

    You must be logged in to add a note. Login now or register for an account.

    Cancel
    Dog-earJan 28, 10, 9:55 p.m. – Permalink
  • noiseisthis

    var bgList = ["http://src.to.bg.com.jpg", "http://src.to.bg2.com.jpg",...]

    $(document).ready(function(){
    $("body").css("background", bgList[i]);
    $("#button").click(function(){
    i++
    if(i>bgList.length) i=0;
    $("body").css("background", bgList[i]);
    });
    }

    you need to dl jquery to do this ^^^^

    next note >add note

    You must be logged in to add a note. Login now or register for an account.

    Cancel
    Dog-earJan 29, 10, 12:04 a.m. – Permalink
  • BusterBoy

    Thanks for everyone's help on this. The code that is working is below - it triggers on mouseover:

    <script type="text/javascript">
    $(window).load(function(){
    $("#linky").mouseover(function...
    $('body').css("background-image... bg-pink.gif )");
    return false;
    });
    });

    Then the HTML trigger:
    a href="#" id="linky">clicky</a

    Just wondering how I could accomlish the trigger from within flash?

    next note >add note

    You must be logged in to add a note. Login now or register for an account.

    Cancel
    Dog-earFeb 3, 10, 7:35 p.m. – Permalink
  • noiseisthis

    flash:
    import flash.external.ExternalInterface...
    import flash.events.MouseEvent;

    trigger_mc.addEventListener(Mous... onTrigger);
    function onTrigger(event:MouseEvent):void {
    // the method that you want to call in javascript goes in the quotes
    ExternalInterface.call("trigger...
    }

    --------------------------------
    javascript:
    <script type="text/javascript">
    $(window).load(function(){
    $("#linky").mouseover(
    trigger();
    });
    });

    function trigger() {
    $('body').css("background-image... bg-pink.gif )");
    return false;
    }
    </script>

    next note >add note

    You must be logged in to add a note. Login now or register for an account.

    Cancel
    Dog-earFeb 3, 10, 8:42 p.m. – Permalink
  • noiseisthis

    use this instead http://pastebin.com/m716b9290

    • struggling a bit here buddy...can I send you an email?BusterBoy
    + add note

    You must be logged in to add a note. Login now or register for an account.

    Cancel
    Dog-earFeb 3, 10, 8:48 p.m. – Permalink

Login or Register to respond to this

Skip to main content