Giter Club home page Giter Club logo

Comments (9)

ProLoser avatar ProLoser commented on May 24, 2024

I would suggest using jquery to perform the image-swap, or css if possible. You'll have a MUCH easier time of it with either of these two solutions.

from anythingslider.

AdamMerrifield avatar AdamMerrifield commented on May 24, 2024

would you like me to send you a zip of an example?

& before i do i'll try with jquery, do you have a recommendation or example i can refer to?

from anythingslider.

Mottie avatar Mottie commented on May 24, 2024

Merrifield69, try adding an ID like this:

 <a href="#"><img src="images/slide-civil-1.jpg" id="test" alt="" /></a>

 $('#test').hover(function(){
  this.old = this.src;
  this.src = 'images/slide-env-1.jpg';
 },function(){
  this.src = this.old;
 });

from anythingslider.

AdamMerrifield avatar AdamMerrifield commented on May 24, 2024

Thank you Morttie,
This jquery rollover does work outside of the li tags
but once inclosed in li tags it does not work. like so

<div class="anythingSlider">
    <div class="wrapper">
        <ul>
            <li>
                <a href="#"><img src="images/ring/ring.png" id="test" alt="" /></a>
            </li>
        </ul>
    </div>
</div>
    <script type="text/javascript">
$('#test').hover(function(){
 this.old = this.src;
 this.src = 'images/ring/project_on.png';
},function(){
 this.src = this.old;
});
    </script>

from anythingslider.

Mottie avatar Mottie commented on May 24, 2024

It works for me.. I think you need to wrap the script above with a $(document).ready(function(){...}), like this:

$(document).ready(function(){
 $('#test').hover(function(){
  this.old = this.src;
  this.src = 'images/slide-civil-2.jpg';
 },function(){
  this.src = this.old;
 });
});

from anythingslider.

AdamMerrifield avatar AdamMerrifield commented on May 24, 2024

Beautiful, that works Mottie, thank you for that.

last question i promise :]
is there anyway to change this image to different images based on where the user hovered. previously i was using an image map and an onmouseover swap image script, but im not sure how i would do that with jquery...

Thank you

from anythingslider.

ProLoser avatar ProLoser commented on May 24, 2024

Well you could create a bunch of links and position them using css on top of an image in different arrangements, creating hover events for each. Honestly though when the hovering approach gets complex I still fall back to a map out of convenience. Nothing stops you from using jquery with a map though, just learn how to use jQuery selectors properly.

from anythingslider.

AdamMerrifield avatar AdamMerrifield commented on May 24, 2024

I've finally got it working!

Thank you very much ProLoser & Mottie

from anythingslider.

ProLoser avatar ProLoser commented on May 24, 2024

No problem, glad it works.

from anythingslider.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.