Kwissle

My real-time quiz battle game Kwissle.com

Crosstips.org

My fun Crossword solver project. Crosstips.org & Krysstips.se

Kung Fu

Fujian White Crane Kung Fu

Photos

Photoalbum, both old and new.

Twitter

Follow me on Twitter

Contact me

My contact details and how to contact me.

 

KungFuPeople.com
Do you train Kung Fu?
Or know someone who does?
Then check out KungFuPeople.com


Mobile version of this page Mobile version of this page


 
JavaScript

jQuery and Highslide JS

http://vikjavev.no/highslide/forum/viewtopic.php?p=5190#5190

8th of January 2008

If you use the wonderful Javascript library jQuery and the wonderful (standalone) Javascript plugin Highslide JS of recent version you should be aware of something.

As of recent versions of Highlide the way the Expander function works is that it looks at an element's onclick attribute and not it's attached events which means that if a DOM element has the event but not the attribute you get a Javascript error. In older versions of Highslide you were able to do this:

 $('a.highslide').click(function() {
    return hs.expand(this, options);
 });

But that's no longer working since the attribute isn't set. Here's the new way of doing it:

 $('a.highslide').each(function() {
    this.onclick = function() {
      return hs.expand(this, options);
    };
 });



Comment

Lukas - 16th May 2008  [«« Reply to this]
Hi Peter!
I would like to call up Highslide for every markup putting this script in the header...but it doesn't work! Could you maybe help? Thank you!! ~Lukas

<script type="text/javascript">
$('a').each(function(){
this.onclick = function() {
return hs.htmlExpand(this, { objectType: 'iframe' } );
});
</script>
Peter Bengtsson - 18th May 2008   [«« Reply to this]
I think there's a forum on the Highslide website. Ask there.
DUzun - 18th June 2010  [«« Reply to this]
Hi, Lukas!
Try putting that script in the body of the document.
Domas - 2nd April 2011  [«« Reply to this]
//or just use it like this ;)

$(document).ready(function() {
$('a.highslide').each(function() {
this.onclick = function() {
return hs.expand(this);
};
});
});
 
Name:
Email:
hide my email address.

Your email address will be encoded to prevent email-extraction spiders from reading it so you won't get spammed if you decide to show your email address.